c# - 未为项目设置 OutputPath 属性

标签 c# msbuild

我有一个已在 Team City 中成功构建了一年多的解决方案。开发人员向解决方案添加了两个项目,我们立即收到以下错误:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(483, 9):未为项目“Compass.Communication.Server.Config.csproj”设置 OutputPath 属性。请检查以确保您已为此项目指定了有效的配置和平台组合。配置='DEV' 平台='AnyCPU'。您可能会看到此消息,因为您正尝试在没有解决方案文件的情况下构建项目,并且指定了该项目不存在的非默认配置或平台。

项目 Compass.Communication.Server.Config\Compass.Communication.Server.Config.csproj 失败。 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(483, 9):未为项目“Compass.Communication.Server.Processor.csproj”设置 OutputPath 属性。请检查以确保您已为此项目指定了有效的配置和平台组合。配置='DEV' 平台='AnyCPU'。您可能会看到此消息,因为您正尝试在没有解决方案文件的情况下构建项目,并且指定了该项目不存在的非默认配置或平台。

我已经尝试了我能找到的关于任何 CPU 与 AnyCPU 的大部分内容以及许多其他东西,但都没有成功。这是第一个的项目文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{5FC19B70-7DB4-4D8A-B33F-748528E5A042}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Compass.Communication.Server.Config</RootNamespace>
    <AssemblyName>Compass.Communication.Server.Config</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <DocumentationFile>bin\Debug\Compass.Communication.Server.Config.XML</DocumentationFile>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="CommunicationConditionalElement.cs" />
    <Compile Include="CommunicationConditionalSection.cs" />
    <Compile Include="CommunicationConfigurationManager.cs" />
    <Compile Include="CommunicationCriterionElement.cs" />
    <Compile Include="CommunicationCriterionSection.cs" />
    <Compile Include="CommunicationElementExtensions.cs" />
    <Compile Include="CommunicationIntroductionElement.cs" />
    <Compile Include="CommunicationIntroductionSection.cs" />
    <Compile Include="CommunicationSectionElement.cs" />
    <Compile Include="CommunicationSectionSection.cs" />
    <Compile Include="CommunicationTypeElement.cs" />
    <Compile Include="CommunicationTypeSection.cs" />
    <Compile Include="GenericConfigurationElementCollection.cs" />
    <Compile Include="RefElement.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Compass.Communication.Entities\Compass.Communication.Entities.csproj">
      <Project>{25B8C709-0574-496E-BD1D-5F4DF966F258}</Project>
      <Name>Compass.Communication.Entities</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

最佳答案

几周前我遇到了类似的问题,在我的案例中,问题是由于“任何 CPU”之间的空间引起的

您需要确保“AnyCPU”在构建定义中使用的任何位置都不包含任何空格。

问候

关于c# - 未为项目设置 OutputPath 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20891245/

相关文章:

delphi - MSBuild 中的空行而不是任务控制台输出

c# - 记录 WCF soap 消息参数和方法名称

c# - 显示对话框后启动时任务卡住 UI

C# Action lambda 限制

c# - 模拟 msbuild 过程的程序集解析

tfs - 错误: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found

c# - 如何从 Windows Phone 7 中的 m3u8 文件流式传输视频文件

c# - 如何删除Linq to Entity中的多条记录?

msbuild - 如何指定 MSBuild 的平台?

MSBUILD 为解决方案中的所有项目生成 xml 文档文件(不涉及项目)