I made a Razor class library project as following in .NET 5.0
I want to make a NuGet package with the Areas folder inside it
So that whenever this package is installed, the whole folder with all its files in the destination will be copied with the same name.
How to pack the whole Areas folder via dotnet pack command?



Try this:
1) create a
<packages_id>.propsfile underbuildfolder of the project folder. In your side, it should be named asRazorClassLibrary1.propsso that the file will work. See this link.And if your nuget package is called
RazorClassLibrary1.1.0.0.nupkg, the file should beRazorClassLibrary1.propsand keep the name same as the package id.2) add these under
RazorClassLibrary1.props:3) add these on
RazorClassLibrary1.csprojfile:Also, when you install this new version of nuget package, please clean your nuget caches or delete all files under
C:\Users\xxx(current user)\.nuget\packages.Besides, here is a similar issue.