【发布时间】:2012-09-03 03:21:37
【问题描述】:
我有 3 个配置项目:
- 项目 A:调试|AnyCPU,发布|AnyCPU
- 项目 B:调试|AnyCPU,发布|AnyCPU
- 项目 C:Debug|x86、Debug|x64、Release|x86、Release|x64
项目 C 在依赖项中有 B,而 B 在依赖项中有 A。 (A
我使用 *.bat 文件从命令行构建它:
msbuild A.csproj /target:Build /property:Configuration=Debug;Platform=AnyCPU /verbosity:minimal
msbuild A.csproj /target:Build /property:Configuration=Release;Platform=AnyCPU /verbosity:minimal<br/>
msbuild B.csproj /target:Build /property:Configuration=Debug;Platform=AnyCPU /verbosity:minimal
msbuild B.csproj /target:Build /property:Configuration=Release;Platform=AnyCPU /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Debug;Platform=x86 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Release;Platform=x86 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Debug;Platform=x64 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Release;Platform=x64 /verbosity:minimal
并收到错误:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(609,5):错误:未为项目“A.csproj”设置 OutputPath 属性。请检查以确保您为此项目指定了有效的配置和平台组合。配置='调试'平台='x86'。您可能会看到此消息,因为您正在尝试构建没有解决方案文件的项目,并且指定了该项目不存在的非默认配置或平台。 [A.csproj] C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(609,5):错误:未为项目“B.csproj”设置 OutputPath 属性。请检查以确保您为此项目指定了有效的配置和平台组合。配置='调试'平台='x86'。您可能会看到此消息,因为您正在尝试构建没有解决方案文件的项目,并且指定了该项目不存在的非默认配置或平台。 [B.csproj]
【问题讨论】:
-
.dll 引用而不是 ProjectReference 不好,我希望在每个构建上也建立依赖关系。为主项目定义“任何 CPU”也很糟糕,因为它不是“任何 CPU”,而是 x86 或 x64。对我来说,这个问题并没有很好地解决。在正确完成之前,我将停止对我的项目使用 MSBuild。我想我也可以从命令行使用 devenv.exe 构建,但它表明这是不推荐使用的并且它是错误的,devenv 有时会挂起直到无缘无故被杀死。
标签: visual-studio msbuild platform