28

MVC4では、ソリューション内のすべてのプロジェクトに対して新しいビルド構成を作成すると、Web.csprojのみをビルドすると次のようになります。

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

[エラー]C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(483、9):プロジェクト'Company.Directory.Web.csproj'のOutputPathプロパティが設定されていません。このプロジェクトの構成とプラットフォームの有効な組み合わせが指定されていることを確認してください。Configuration ='Dev' Platform='AnyCPU'。ソリューションファイルなしでプロジェクトをビルドしようとしていて、このプロジェクトに存在しないデフォルト以外の構成またはプラットフォームを指定したために、このメッセージが表示される場合があります。

ただし、OutputPathプロパティは設定されています!

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

これはバグですか?どうすれば修正できますか?

4

5 に答える 5

43

最初のPropertyGroupものが重要であることがわかります。Visual StudioはPropertyGroup、何らかの理由でその前に新しい構成(Dev)を挿入しました。バグだと思います。新しい構成を他の構成の後に移動することで修正しました。

<?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>
  <!-- ... -->
于 2012-08-31T15:33:43.363 に答える
6

msbuild.exeを使用してコマンドラインからビルドしようとすると、同様のエラーが発生しました。私の問題は、「AnyCPU」を配置する必要があるときに「AnyCPU」を指定していたことでした。

于 2013-06-11T16:09:28.033 に答える
2

私はプロジェクトで同様の問題を抱えていAzureました。ソリューションに新しい構成を追加した後Release-CLOUD-STAGE、同じエラーが発生し始めました。

OutputPathプロパティがプロジェクトに設定されていません

エディターでファイルを開いてccproj新しい構成を検索した後、ファイルの終わり近くにこれが表示されました。

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

私にはすべてがうまく見えました-既存の構成Release-CLOUDはうまく機能しましたが、新しい構成は機能しませんでした。そのプロジェクトファイルには、プロジェクトファイルの最初に2つの要素(1つはCOMPLETEPropertyGroup )があります。

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

そして、何らかの理由で、ファイルの終わり近くに挿入された、上記のSHORTバージョンがあります。PropertyGroup新しい構成用に要素の適切なCOMPLETEバージョンを作成した後Release-CLOUD-STAGE(および両方のSHORTバージョンを削除した後)、すべてが準拠しました。

これがAzure固有であるかどうかはわかりませんが、これに時間を浪費したので、調査結果も共有したいと思います。

于 2014-01-04T12:45:36.660 に答える
0

条件のないPropertyGroup要素が2つありましたが、後者が前者の有効化を妨げていたと思います。すべての子アイテムを最初のPropertyGroup要素に統合し、2番目の要素を削除すると、その後、作業が開始されました。

于 2015-04-06T14:55:52.910 に答える
0

Azure WebRoleプロジェクトで同じエラーが発生し、<PropertyGroup>要素を.csprojファイルに手動で追加しました。しかし、私は誤ってそれらをいくつかの<Import>ステートメントの下に置きました。ビルドは質問のエラーで失敗します。

正しい順序

<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" />

注文間違い

<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>
于 2015-06-26T11:36:19.230 に答える