我正在尝试使用MSBuild来构建一个指定目标平台的解决方案(我需要x86和x64两种二进制文件)。这是我的尝试方法:
C:\WINDOWS\Microsoft.NET\Framework\v3.5>MsBuild SolutionPath\Solution.sln /t:Rebuild /p:Configuration=Release /p:Platform="x86"
然而,如果平台与"Any CPU"不同,则构建始终失败。我做错了什么吗?
这是MSBuild打印的完整输出内容:
C:\WINDOWS\Microsoft.NET\Framework\v3.5>MsBuild SolutionPath\Solution.sln /t:Rebuild /p:Configuration=Release /p:Platform="x86" Microsoft (R) Build Engine Version 3.5.30729.1 [Microsoft .NET Framework, Version 2.0.50727.3082] Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 1.7.2010 8:28:10. Project "SolutionPath\Solution.sln" on node 0 (Rebuild targe t(s)). SolutionPath\Solution.sln : error MSB4126: The specified sol ution configuration "Release|x86" is invalid. Please specify a valid solution c onfiguration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those prope rties blank to use the default solution configuration. Done Building Project "SolutionPath\Solution.sln" (Rebuild t arget(s)) -- FAILED.
Build FAILED.
"SolutionPath\Solution.sln" (Rebuild target) (1) -> (ValidateSolutionConfiguration target) -> SolutionPath\Solution.sln : error MSB4126: The specified s olution configuration "Release|x86" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.ex e Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those pro perties blank to use the default solution configuration.
0 Warning(s) 1 Error(s)
Time Elapsed 00:00:00.03
如果我使用devenv尝试为x86/x64构建它,它可以完美工作。但是,我正在尝试设置一个构建服务器,而不安装所有必要的Visual Studio版本。顺便说一句,如果有更好的免费工具(支持.NET framework 4),我很想听听。
Win32
,而现代.NET使用x86
。 - Elliot Woods