Creating a NuGet package for my .NET Standard class library

I successfully created and published my first NuGet package that included a .NET Standard class library here.  It is nothing specificly awesome but it’s pretty cool, simple and something I have never done before.  I simply executed this msbuild command on my .NET Standard class library and it built the package for me.

msbuild CSharpProjectName.csproj /t:pack /p:Configuration=Release

Before I came to the above command conclusion I found another example like this:

dotnet pack --no-build

Not really knowing what that did, I got the below exception when running the command.

 ** Visual Studio 2017 Developer Command Prompt v15.0.26730.15
 ** Copyright (c) 2017 Microsoft Corporation

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cd C:\BeginningCSharp7\Chapter18\Ch18CardLibStandard

C:\BeginningCSharp7\Chapter18\Ch18CardLibStandard>dotnet pack --no-build
 Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
 Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\2.0.0\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(141,5): error : The file 'C:\BeginningCSharp7\Chapter18\Ch18CardLibStandard\Ch18CardLibStandard\bin\Debug\netstandard2.0\Ch18CardLibStandard.dll' to be packed was not found on disk. [C:\BeginningCSharp7\Chapter18\Ch18CardLibStandard\Ch18CardLibStandard\Ch18CardLibStandard.csproj]


The exception was pretty clear that it could not find the DEBUG version of my project, that was because I never compiled a DEBUG version, I went straight to RELEASE without passing GO!  I must assume by not using the p: parameter it defaults to DEBUG.  Not sure still what the –no-build parameter does, I need to read the manual I guess.

Comments (0)

Skip to main content