2012-08-31 22 views
28

En MVC4, si se crea una nueva configuración de construcción para todos los proyectos en una solución, me sale el siguiente en la construcción de la .csproj web solo:"La propiedad OutputPath no está configurado para el proyecto" cuando se establece OutputPath

msbuild Company.Directory.Web.csproj /p:Configuration=Dev 

[Error] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(483, 9): The OutputPath property is not set for project 'Company.Directory.Web.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Dev' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

Sin embargo, la propiedad OutputPath está establecida.

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'"> 
    <DebugSymbols>true</DebugSymbols> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <DebugType>full</DebugType> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <ErrorReport>prompt</ErrorReport> 
    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 
    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 
    <DeployIisAppPath>Port 80/directory/dev</DeployIisAppPath> 
    </PropertyGroup> 
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> 
    <PropertyGroup> 
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    <ProductVersion> 
    </ProductVersion> 
    <SchemaVersion>2.0</SchemaVersion> 
    <ProjectGuid>{285FBF79-7933-4AF9-AAAF-25EE7734AAAA}</ProjectGuid> 
    <ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> 
    <OutputType>Library</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>Company.Directory.Web</RootNamespace> 
    <AssemblyName>Company.Directory.Web</AssemblyName> 
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 
    <MvcBuildViews>false</MvcBuildViews> 
    <UseIISExpress>true</UseIISExpress> 
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> 
    <RestorePackages>true</RestorePackages> 
    </PropertyGroup> 
    <!-- ... --> 

Es esto un error? ¿Cómo puedo arreglarlo?

Respuesta

43

Resulta que el primer PropertyGroup es importante. Visual Studio insertó la nueva configuración (Dev) PropertyGroup antes por alguna razón. Supongo que es un error. Lo arreglé moviendo la nueva configuración después de las otras.

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> 
    <PropertyGroup> 
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    <ProductVersion> 
    </ProductVersion> 
    <SchemaVersion>2.0</SchemaVersion> 
    <ProjectGuid>{285FBF79-7933-4AF9-AAAF-25EE7734AAAA}</ProjectGuid> 
    <ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> 
    <OutputType>Library</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>Company.Directory.Web</RootNamespace> 
    <AssemblyName>Company.Directory.Web</AssemblyName> 
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 
    <MvcBuildViews>false</MvcBuildViews> 
    <UseIISExpress>true</UseIISExpress> 
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> 
    <RestorePacCompanyes>true</RestorePacCompanyes> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <DebugSymbols>true</DebugSymbols> 
    <DebugType>full</DebugType> 
    <Optimize>false</Optimize> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    <DebugType>pdbonly</DebugType> 
    <Optimize>true</Optimize> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    </PropertyGroup> 
    <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'"> 
    <DebugSymbols>true</DebugSymbols> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <DebugType>full</DebugType> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <ErrorReport>prompt</ErrorReport> 
    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 
    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 
    <DeployIisAppPath>Port 80/directory/dev</DeployIisAppPath> 
    </PropertyGroup> 
    <!-- ... --> 
+2

+1 3 horas de intentar soluciones Duff y golpear éste dio en el clavo, saludos! Paul –

+0

Me alegro de poder ayudar! – jrummell

+0

¡eh! ... esto ahorró mucha frustración y tiempo ... gracias – surya

5

Tuve un error similar al intentar compilar desde la línea de comandos con msbuild.exe. Mi problema era que estaba especificando 'Cualquier CPU' cuando debería haber puesto 'AnyCPU'.

2

Tuve un problema similar con el proyecto Azure. Después añadí nueva configuración Release-CLOUD-STAGE en la solución, empecé a recibir el mismo error:

The OutputPath property is not set for project

Después abrí el archivo ccproj en el editor y buscado para la nueva configuración, vi esta cerca del final de la misma:

<PropertyGroup Condition=" '$(Configuration)' == 'Release-CLOUD' "> 
    <OutputPath>bin\Release-CLOUD\</OutputPath> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)' == 'Release-CLOUD-STAGE' "> 
    <OutputPath>bin\Release-CLOUD-STAGE\</OutputPath> 
    </PropertyGroup> 

todo me pareció bien - la configuración existente Release-CLOUD funcionaba bien, pero la nueva no. Resulta que hay DOS PropertyGroup elementos en ese archivo de proyecto - uno - COMPLETA - en el principio del archivo de proyecto:

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

y luego por alguna razón no es otra, versión corta he mostrado antes , insertado cerca del final del archivo. Después de crear la versión COMPLETA correcta del elemento PropertyGroup para la nueva configuración Release-CLOUD-STAGE (y eliminé ambas versiones CORTES), todo se cumplió.

No estoy seguro de si eso es específico de Azure, pero perdí algo de tiempo en esto, así que me gustaría compartir mis hallazgos también.

0

Tenía dos elementos de PropertyGroup sin condiciones, y creo que esto último impedía que el anterior entrara en vigor. Consolidé todos los elementos secundarios en el primer elemento PropertyGroup y me deshice del segundo, y las cosas comenzaron a funcionar después de eso.

0

Obtuve el mismo error para un Azure WebRole-project y agregué los elementos <PropertyGroup> manualmente en el archivo .csproj. Sin embargo, accidentalmente los puse debajo de un par de declaraciones <Import>. La compilación fallará con el error en la pregunta.

orden correcto

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'"> 
    <DebugSymbols>true</DebugSymbols> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <DebugType>full</DebugType> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <ErrorReport>prompt</ErrorReport> 
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 
</PropertyGroup> 
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> 
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> 

orden incorrecto

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> 
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> 
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'"> 
    <DebugSymbols>true</DebugSymbols> 
    <OutputPath>bin\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <DebugType>full</DebugType> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <ErrorReport>prompt</ErrorReport 
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 
</PropertyGroup> 
Cuestiones relacionadas