首页 文章

未为项目设置OutputPath属性

提问于
浏览
3

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

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

Project 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属性 . 请检查以确保您为此项目指定了Configuration和Platform的有效组合 . Configuration ='DEV'Platform ='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>

6 回答

  • 0

    刚通过.csproj文件中的“x64”手动替换'AnyCPU'解决了类似的问题:

    <Platform Condition=" '$(Platform)' == '' ">x64</Platform\>
    
  • 10

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

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

    问候

  • 0

    您可以将以下内容直接添加到下面的项目文件中

    <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> 
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel> 
    </PropertyGroup>
    
  • 1

    当您的项目未设置为活动解决方案配置构建但由项目引用时,通常会发生这种情况 . 检查visual studio并确保已将发布和调试解决方案配置添加到新项目中 .

  • 0

    我有同样的错误 .

    试试 delete the "Platform" environment variable.

    然后重启VS,构建解决方案......

  • -1

    您可以手动将OutputPath属性插入DLL类库的proj文件中 . 下面是一个代码片段/示例 .

    <propertygroup condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> 
    </propertygroup> 
    <codeanalysisruleset>MinimumRecommendedRules.ruleset</codeanalysisruleset>
    <errorreport>prompt</errorreport>
    <platformtarget>x64</platformtarget>
    <debugtype>full</debugtype>
    <defineconstants>DEBUG;TRACE</defineconstants>
    <outputpath>bin\x64\Debug\</outputpath>
    <debugsymbols>true</debugsymbols>
    

    您也可以按照以下步骤操作:

    • 右键单击解决方案 - >属性

    • 单击“配置属性”,然后单击“配置管理器”

    • 单击类库的平台下拉列表,然后选择“新建...”

    • 在弹出对话框中,确保新平台为x64,取消选中“创建新的解决方案平台”,然后单击“确定” .

相关问题