Hinrich
Hinrich

Reputation: 13983

Creating nuget packages in Visual Studio 2017

In Visual Studio 2017, I have a C# class library that targets netcoreapp2.0. It is a csproj type project. I have installed nuget v4.5.

I would like to generate nuget packages from that library. In the project properties, I filled out the relevant package information. I followed this guide to set everything up.

When I click on the pack command for that project, the project gets rebuild but no nupgk is generated. Output is this:

1>------ Build started: Project: DuDiKiCommon, Configuration: Debug Any CPU ------ 1>DuDiKiCommon -> E:\repositories\DuDiKiCommon\DuDiKiCommon\bin\Debug\netcoreapp2.0\DuDiKiCommon.dll ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

What might I be missing here?

Upvotes: 2

Views: 1861

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

You can use dotnet pack -c Release or (in the developer command prompt) msbuild /restore /t:Pack /p:Configuration=Release to trigger the .nupkg generation.

You do not need nuget.exe for that.

Int this specific case, the dependency on xunit marks the project as test project which are not packable by default.

Use the xunit.extensibility.core package instead to ship helper logic or set this in the .csproj file:

<PropertyGroup>
  <IsPackable>true</IsPackable>
</PropertyGroup>

See this GitHub issue for more details.

Upvotes: 1

Related Questions