Reputation: 11032
I use the new SDK style project of VS2017
In dotnet I can Pack using the command:
dotnet pack project.csproj --no-dependencies --no-restore --output c:\packages -p:TargetId=abc -p:configuration=release
In msbuild, I can pack using the command:
msbuild project.csproj /t:pack -p:TargetId=abc -p:configuration=release
How to set the options of dotnet --no-dependencies --no-restore --output
using msbuild
Upvotes: 2
Views: 1694
Reputation: 100543
--no-restore
doesn't need to be translated. If you do want to restore, pass -restore
(short form -r
) to msbuild.--no-build
translates to -p:NoBuild=true
--no-dependencies
translates to -p:RestoreRecursive=false
(note that this doesn't really need to be used together with --no-restore
)--output
translates to -p:PackageOutputPath=C:\some\path
Do note that other commands such as build
translate --no-dependencies
to something different: -p:BuildProjectReferences=false
which does not build project-to-project references, which may be what you want instead.
The full mapping from command line arguments to MSBuild parameters is spread over a few source files in the dotnet/cli GitHub Repo:
pack
command arguments.More parameters that are supported by the NuGet targets - which you could set from both the command line or the project file - are documented at NuGet pack and restore as MSBuild targets.
Upvotes: 7