[英]MSBuild: How to conditionally import another project in a .csproj file based on the name of build-originated project?
[英]Build .csproj with MSBuild without project reference
从头开始编写MSBuild文件时,是否可以直接构建.csproj文件而无需引用他们所属的解决方案? 像这样的介绍性指南经常解释如何编译单个.cs文件或直接从命令行构建.csproj。
例如,没有.sln引用的命令行MSBuild:
msbuild helloworld.csproj /t:Build /verbosity:detailed
或.csproj给出.sln:
<MSBuild
Projects="mysolution.sln"
Targets="My_Project_File"
Properties="Configuration=$(Configuration);Platform=$(Platform)"
ContinueOnError="false" />
我没有找到任何提及在没有.sln的MSBuild文件中构建.csproj的引用。 有没有办法,我只是缺少一些东西?
没有解决方案构建csproj文件没有任何错误:
<MSBuild Projects="my_project.csproj" Targets="Build" />
此外,当您使用Visual Studio构建解决方案时,它在内部实际执行的操作是将解决方案文件转换为包含如上所述的行的msbuild脚本来构建项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.