创建sfproj包的MSBuild失败:未为项目设置OutputPath属性

时间:2017-08-13 11:25:16

标签: build msbuild azure-service-fabric csproj msbuild-propertygroup

我正在使用以下命令行:

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" MyApp.sln /p:configuration="Release" /t:Build
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" MyApp.sfproj /p:platform="Any CPU" /p:configuration="Release" /t:Package

第一行正常,但第二行失败,错误

"MyApp.sfproj" (Package target) (1) ->
"AppProj.csproj" (default target) (4) ->
  C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'AppProj.csproj'.
  Please check to make sure that you have specified a validcombination of Configuration and Platform for this project.
  Configuration='Release'  Platform='Any CPU'.
  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. [AppProj.csproj]

我的申请中的一些项目。

我在相关PropertyGroup中定义了以下csproj

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\x64\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <PlatformTarget>x64</PlatformTarget>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\x64\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <PlatformTarget>x64</PlatformTarget>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </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>

当我从VS2015 / 2017部署应用程序时,它运行良好,bin\pkg按预期创建。

1 个答案:

答案 0 :(得分:2)

尝试在VSTS上构建时,在将Microsoft.VisualStudio.Azure.Fabric.MSBuild升级到1.6.3(从1.6.1开始)后,我遇到了同样的问题。

我通过将所有目标平台更改为以前为'x64'的'任何CPU'来修复它。

请参阅https://github.com/Azure/service-fabric-issues/issues/64#issuecomment-323942996