What is the major difference between dotnet pack
and publish
?
From Microsoft's description, my understanding is that pack
creates a package while publish
creates package + DLL.
Is this correct?
If so, why not just always use publish
and not use the DLL file if it is not needed.
dotnet pack
- Produces a NuGet package of your code.
That is the key difference - this will enable to publish to http://nuget.org, or to a nuget server that can be pulled down by other developers, or even for use with Octopus Deploy.
dotnet publish
- Produces a .NET framework-dependent or self-contained application.
Keyword is "self-contained", a installer perhaps, or a folder that can be deployed by copying/pasting between hosts.