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 Studio2017Community>cd C:BeginningCSharp7Chapter18Ch18CardLibStandard C:BeginningCSharp7Chapter18Ch18CardLibStandard>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 Filesdotnetsdk2.0.0SdksNuGet.Build.Tasks.PackbuildNuGet.Build.Tasks.Pack.targets(141,5): error : The file 'C:BeginningCSharp7Chapter18Ch18CardLibStandardCh18CardLibStandardbinDebugnetstandard2.0Ch18CardLibStandard.dll' to be packed was not found on disk. [C:BeginningCSharp7Chapter18Ch18CardLibStandardCh18CardLibStandardCh18CardLibStandard.csproj] C:BeginningCSharp7Chapter18Ch18CardLibStandard>
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.