If you're migrating from ASP.NET-Core 2.x to 3.x, since ASP.NET-Core 3.0 and above, Microsoft.NET.Sdk.Web MSBuild SDK doesn't automatically include Microsoft.Extensions.FileProviders.Embedded NuGet package anymore.
Microsoft.Extensions.FileProviders.Embedded needs to be added explicitly.
<Project Sdk="Microsoft.NET.Sdk.Web"> ... <ItemGroup> <PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.0.3" /> <!-- Or use version 3.1.2 for ASP.NET-Core 3.1 --> </ItemGroup> ... </Project> <Project Sdk="Microsoft.NET.Sdk.Web"> ... <ItemGroup> <PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.0.3" /> <!-- Or use version 3.1.2 for ASP.NET-Core 3.1 --> </ItemGroup> ... </Project> For those not migrating from 2.x to 3.x, don't forget to also add the following to your .csproj:
<Project Sdk="Microsoft.NET.Sdk.Web"> ... <PropertyGroup> <GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> </PropertyGroup> ... <ItemGroup> <EmbeddedResource Include="..." /> <!-- Add your directories and/or files here. --> </ItemGroup> ... </Project> <Project Sdk="Microsoft.NET.Sdk.Web"> ... <PropertyGroup> <GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> </PropertyGroup> ... <ItemGroup> <EmbeddedResource Include="..." /> <!-- Add your directories and/or files here. --> </ItemGroup> ... </Project>