【发布时间】:2014-06-21 10:12:57
【问题描述】:
从头开始编写 MSBuild 文件时,是否可以直接构建 .csproj 文件而不引用它们所属的解决方案? this one 之类的介绍性指南经常解释如何编译单个 .cs 文件或直接从命令行构建 .csproj。
例如,没有 .sln 引用的命令行 MSBuild:
msbuild helloworld.csproj /t:Build /verbosity:detailed
或者给定一个 .sln 的 .csproj:
<MSBuild
Projects="mysolution.sln"
Targets="My_Project_File"
Properties="Configuration=$(Configuration);Platform=$(Platform)"
ContinueOnError="false" />
我没有找到任何提到在没有 .sln 的 MSBuild 文件中构建 .csproj 的参考资料。有没有办法,我只是错过了什么?
【问题讨论】:
-
你刚刚试过
<MSBuild Projects="my_project.csproj" Targets="Build" />吗? -
您的个人项目是否引用任何其他项目..“按项目”?
-
@stijn 有效。非常感谢。您也应该将其添加为答案。
-
1.回复:“没有提及他们所属的解决方案”。如果您不知道,项目是零个或多个解决方案的未知成员(可能位于文件系统中的任何位置)。 2. 如果您有兴趣,MSBuild 可以通过将其动态转换为临时 MSBuild 项目文件来构建 Visual Studio 解决方案文件。
标签: c# visual-studio-2012 msbuild csproj