Skip to content

Instantly share code, notes, and snippets.

@rrelyea
Last active May 30, 2019 15:18
Show Gist options
  • Save rrelyea/ebb6dad974228a381bd3c81b96ec40f7 to your computer and use it in GitHub Desktop.
Save rrelyea/ebb6dad974228a381bd3c81b96ec40f7 to your computer and use it in GitHub Desktop.
CLI Techniques - 2012 to Present

Evolving NuGet CLI options:

  • 2012: NuGet.exe + msbuild
  • 2017: msbuild centric, with nuget.exe to push packages
  • 2017: dotnet.exe centric
@md classlib-packages
dotnet new classlib -o classlib1
@echo build a netstandard class library with msbuild - restore, pack, and push with nuget.exe
@echo -- technique since ~2013
cd classlib1
nuget restore classlib1.csproj
msbuild /t:build /p:Configuration=Release /verbosity:minimal
nuget pack -prop Configuration=Release -OutputDirectory bin\release\
nuget push bin\release\*.nupkg -source c:\temp\classlib-packages\
cd ..
dotnet new classlib -o classlib2
@echo restore, build and pack a netstandard class library with msbuild - push with nuget.exe
@echo - when using PackageReferences only, and no Packages.Config, msbuild (15.6 and later) can do the restore and packing
cd classlib2
msbuild /restore /t:build;pack /p:Configuration=Release /verbosity:minimal
nuget push bin\release\*.nupkg -source c:\temp\classlib-packages\
cd ..
dotnet new classlib -o classlib3
@echo restore, build and pack a netstandard class library with dotnet.exe
@echo - when using PackageReferences only with project types that dotnet sdk supports, dotnet.exe can do it all
cd classlib3
dotnet pack /p:Configuration=Release
dotnet nuget push bin\release\*.nupkg -s c:\temp\classlib-packages\
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment