Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the difference between dotnet pack and msbuild?


Asked by Hadleigh Montes on Dec 08, 2021 FAQ



msbuild -t:pack is functionality equivalent to dotnet pack. To build with MSBuild, see Create a NuGet package using MSBuild. This topic applies to SDK-style projects, typically .NET Core and .NET Standard projects. The following properties are required to create a package.
Subsequently,
Same underlying compiler, different things that invoke it. The compiler itself targets .NET Standard 2.0, and can run on both .NET Framework and .NET Core/5. MSBuild (like VS) runs on .NET Framework, while dotnet buildruns on .NET Core.
Thereof, The build can also fail if there is a locked file or other issue. You can provide MSBuild properties to the dotnet pack command for the packing process. For more information, see NuGet pack target properties and the MSBuild Command-Line Reference.
Additionally,
The dotnet build command is equivalent to dotnet msbuild -restore. When you don't want to build the project and you have a specific target you want to run, use dotnet build or dotnet msbuild and specify the target. Build a project and its dependencies:
Also Know,
The dotnet vstest command is superseded by dotnet test, which can now be used to run assemblies. See dotnet test. dotnet-vstest - Runs tests from the specified assemblies. The dotnet-vstest command runs the VSTest.Console command-line application to run automated unit tests. Run tests from the specified assemblies.