Reputation: 131
I am struggling to get dotnet pack to generate a nuget package from a .NetCore2.1 project.
When I run dotnet pack from the cmd line the project is restored but then it goes no further.
Is this a limitation? I am struggling to find anything valuable online.
I am using AspNetCore.Mvc so moving to standard is not an option...
Thanks.
Upvotes: 2
Views: 3519
Reputation: 1126
As Martin says above, test projects are not packable, in my case, we had an unneeded reference to
Microsoft.NET.Test.Sdk
Upon removing this reference I could package the project
Upvotes: 0
Reputation: 100581
ASP.NET Core and Xunit / test projects aren't packable by default. To create a package containing View assets, create a Razor class library instead. Or create a class library project for .NET Core.
Alternatively, you can add this to your csproj file to force the project to be packable:
<PropertyGroup>
<IsPackable>true</IsPackable>
</PropertyGroup>
Do not that these defaults have been put in place to prevent packages from creating unwanted side-effects or not behaving as expected so use with caution.
Upvotes: 5