Since the original versions of .NET, it has been possible to embed content within the assembly, including binary files. The reason for this is simple—it minimizes the number of files to distribute as they are included within the application binary. For that, we can use Visual Studio to set the Build Action property in the property explorer of Visual Studio:
Then, to retrieve an embedded resource, you will need an instance of either EmbeddedFileProvider (discussed previously) or ManifestEmbeddedFileProvider. These classes belong to theMicrosoft.Extensions.FileProviders.Embedded package and implement the IFileProvider interface, meaning they can be used in any API that expects IFileProvider. You can initialize each of them by passing it an assembly, as follows:
var embeddedProvider = new ManifestEmbeddedFileProvider
(Assembly.GetEntryAssembly());
An optional base namespace can also be passed...