vista tutorial paso net mvc modelo mezclar form entre diferencias controlador asp asp.net-mvc visual-studio-2010 msbuild asp.net-mvc-4

asp.net mvc - tutorial - "La propiedad OutputPath no está configurada para el proyecto" cuando se establece OutputPath



razor mvc (5)

En MVC4, si creo una nueva configuración de compilación para todos los proyectos en una solución, obtengo lo siguiente cuando construyo el .csproj web solo:

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

[Error] C: / Windows / Microsoft.NET / Framework / v4.0.30319 / Microsoft.Common.targets (483, 9): la propiedad OutputPath no está configurada para el proyecto ''Company.Directory.Web.csproj''. Verifique que haya especificado una combinación válida de Configuración y Plataforma para este proyecto. Configuración = ''Dev'' Platform = ''AnyCPU''. Es posible que vea este mensaje porque está tratando de crear un proyecto sin un archivo de solución y ha especificado una configuración o plataforma no predeterminada que no existe para este proyecto.

Sin embargo, la propiedad OutputPath está configurada.

<?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?


Obtuve el mismo error para un proyecto Azure WebRole y agregué los elementos de <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>


Resulta que el primer PropertyGroup es importante. Visual Studio insertó el nuevo grupo de PropertyGroup configuración (Dev) 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> <!-- ... -->


Tenía dos elementos de PropertyGroup sin condiciones, y creo que este último impedía que los primeros tuvieran efecto. 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.


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''.


Tuve un problema similar con el proyecto de Azure . Después de agregar la nueva configuración Release-CLOUD-STAGE a la solución, comencé a recibir el mismo error:

La propiedad OutputPath no está establecida para el proyecto

Después de abrir el archivo ccproj en el editor y buscar la nueva configuración, vi esto casi al final:

<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 parecía bien: la configuración existente Release-CLOUD funcionaba bien, pero la nueva no. Resulta que hay DOS elementos de PropertyGroup en ese archivo de proyecto - uno - COMPLETE - en el comienzo 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, hay otra, la versión CORTA que mostré arriba, insertada cerca del final del archivo. Después de crear la versión COMPLETA adecuada 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 sí desperdicié algo de tiempo en esto, así que me gustaría compartir mis hallazgos también.