我在跑msbuild.exe
通过常规 PowerShell 控制台的 Rake。这是从诊断级别运行打印的命令
“C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe”“D:/Projects/machine.specifications/Source/Machine.Specifications/Machine.Specifications.csproj31881140”/maxcpucount/target:Build/verbosity :诊断 /property:Configuration=调试 /property:TrackFileAccess=false /property:BuildInParallel=false /property:BuildRunner=Rake
并且构建失败,因为 msbuild 正在选择x64
as the Platform
.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483,9): 错误:未为项目“Machine.Specifications.csproj37103470”设置 OutputPath 属性。请检查以确保您已为此项目指定有效的配置和平台组合。配置='调试'平台='X64'。您可能会看到此消息,因为您正在尝试构建没有解决方案文件的项目,并且指定了该项目不存在的非默认配置或平台。
我不会在命令行(或从脚本)中传递它。这csproj
有默认配置
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
以及两个具体配置
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
所以,我预计AnyCPU
待选择的平台。但是,由于某种原因,有些东西正在挑选或发送x64
。我不认为 Rake 系统是一个问题,我之前在对 msbuild 的原始命令行调用中见过这种行为(但我还没有记录它们)。
我使用的是 64 位 Windows 7,调用 msbuild 4.0。我不知道这是否相关。
I am loading https://powershellcx.svn.codeplex.com/svn/Trunk/Src/ReleaseNotes.txt64 位 Visual Studio 工具(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64
) using Invoke-BatchFile
在我的 PowerShell 配置文件中。难道这就是罪魁祸首吗?
为什么 msbuild 会故意选择 x64? 32位版本不会为您选择x86。
*1:PowerShell 控制台位于%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
*2:我正在运行MSpec https://github.com/machine/machine.specifications构建(这是rakefile https://github.com/machine/machine.specifications/blob/master/rakefile.rb和msbuild 调用 https://github.com/machine/machine.specifications/blob/master/Tools/Rake/msbuild.rb#L40)