我想从命令行构建 SLN。我努力了
D:\>msbuild MySolution.sln
问题是它无法构建C
针对 x86 的项目,而项目A
和B
构建正确。它给出了错误:
项目“D:.....\MySolution.sln”(1)正在节点 0(默认目标)上构建“D:.....\MySolution\ToolC\C.csproj”(4)。
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(539,9):错误:未为此项目设置 OutputPath 属性。请检查以确保您指定了有效的配置/平台组合。Configuration='Debug' Platform='AnyCPU'
Done Building Project "D:.....\MySolution\ToolC\C.csproj"(默认目标)——失败。
为什么要C
为目标“任何 CPU”构建?
详细信息
我有 1 个 SLN 文件和 3 个 C# 项目,比如 A、B、C。
项目A
和B
默认针对“任何 CPU”。项目C
针对“x86”
这是 SLN 文件的内容(仅Global
部分):
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Debug|x86.ActiveCfg = Debug|Any CPU
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Release|Any CPU.Build.0 = Release|Any CPU
{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}.Release|x86.ActiveCfg = Release|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Debug|x86.ActiveCfg = Debug|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Release|Any CPU.Build.0 = Release|Any CPU
{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}.Release|x86.ActiveCfg = Release|Any CPU
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Debug|x86.ActiveCfg = Debug|x86
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Debug|x86.Build.0 = Debug|x86
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Release|Any CPU.Build.0 = Release|Any CPU
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Release|x86.ActiveCfg = Release|x86
{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
而且,这是项目的 CSPROJ 文件内容C
:
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
....
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\x86\Debug\</OutputPath>
<PlatformTarget>x86</PlatformTarget>
....
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<PlatformTarget>x86</PlatformTarget>
....
</PropertyGroup>
我也试过这个,但问题仍然存在:
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>