【问题标题】:Use a single Visual Studio solution to build both x86 and x64 at the same time for C++/CLI project使用单个 Visual Studio 解决方案同时为 C++/CLI 项目构建 x86 和 x64
【发布时间】:2013-03-29 21:10:27
【问题描述】:

作为这个问题的后续: Use a single Visual Studio solution to build both x86 and x64 at the same time?

我在 C# 项目的公认答案中使用了该技术,并且效果很好。 有没有办法为 C++/CLI 项目 (.vcxproj) 做同样的事情? 使用该技术似乎不起作用(“BeforeBuild”和“AfterBuild”目标似乎被忽略了) .

我什至可以从解决方案中另一个 C# 项目的 Before/AfterBuild 目标执行任务:

<Target Name="BeforeBuild">
  <MSBuild Condition=" '$(Platform)' == 'x64' " Projects="MyCPPCLIProject.vcxproj" Properties="Platform=x86;" />
</Target>

当我这样做时,我收到以下错误(即使项目在解决方案中):

C:\VS\MyCSProj.csproj(1773,5): error MSB3202: The project file "MyCPPCLIProject.vcxproj" was not found.

【问题讨论】:

  • 尝试为项目文件名指定更多内容。包含相对于 .sln 文件的路径,或使用 $(SolutionDir) 作为完整路径的一部分。
  • 只需使用 Build + Batch Build。

标签: c# visual-studio-2010 msbuild c++-cli


【解决方案1】:

尝试为项目文件名指定更多内容。使用$(SolutionDir) 作为完整路径的一部分。

【讨论】:

  • 在 c# 项目中指定完整路径对我有用,谢谢。
最近更新 更多