![](/img/trans.png)
[英]What's the difference between using dotnet and MSBuild for building .NET applications?
[英]Difference between pack in dotnet and msbuild
我使用VS2017的新SDK样式项目
在dotnet中,我可以使用以下命令进行打包:
dotnet pack project.csproj --no-dependencies --no-restore --output c:\packages -p:TargetId=abc -p:configuration=release
在msbuild中,我可以使用以下命令进行打包:
msbuild project.csproj /t:pack -p:TargetId=abc -p:configuration=release
如何使用msbuild设置dotnet --no-dependencies --no-restore --output
选项
--no-restore
不需要翻译。 如果确实要还原,则将-restore
(缩写为-r
)传递给msbuild。 --no-build
转换为-p:NoBuild=true
--no-dependencies
转换为-p:RestoreRecursive=false
(请注意,这实际上不需要与--no-restore
一起使用) --output
转换为-p:PackageOutputPath=C:\\some\\path
请注意,诸如build
其他命令--no-dependencies
转换为不同的内容: -p:BuildProjectReferences=false
不会构建项目间引用,而您可能希望这样做。
从命令行参数到MSBuild参数的完整映射分布在dotnet / cli GitHub Repo中的一些源文件中:
pack
命令参数。 NuGet目标支持的更多参数(可以在命令行或项目文件中设置)都记录在NuGet包中,并作为MSBuild目标还原 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.