【问题标题】:TargetProfile gives No default service configuration errorTargetProfile 给出 No default service configuration 错误
【发布时间】:2013-01-01 16:11:11
【问题描述】:

我正在 TFS 2012 构建定义中构建 Azure 云服务应用程序。使用默认的 Cloud 配置一切正常。但是,当我在 MSBuild 参数中设置 TargetProfile 属性时,出现以下错误。服务配置文件存在于项目中,我可以在项目属性中进行选择。

我需要做些什么来让构建识别非默认配置吗?

MSBuild 参数

/t:Publish /p:PublishDir=\buildserver\builddrops\LocA\ /p:TargetProfile=CloudLocA

错误信息

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\1.8\Microsoft.WindowsAzure.targets (353): 找不到默认服务配置“ServiceConfiguration.cscfg”项目。

【问题讨论】:

    标签: azure msbuild tfsbuild azure-cloud-services


    【解决方案1】:

    我想通了,它最终与TargetProfile 属性无关。我将构建定义设置为仅清理工作区输出。当我查看构建服务器上的源文件夹时,我意识到它并没有拉下额外的服务配置文件,所以它找不到我在 TargetProfile 属性中指定的内容。我将清理工作区设置更改为全部,现在一切正常。

    【讨论】:

      【解决方案2】:

      您是否尝试过将TargetProfile 绑定到$(Configuration)?在我的上一个项目中,我使用以下设置配置了 Azure 项目,并且运行良好:

       ...
       <PropertyGroup>
        <TargetProfile Condition="'$(TargetProfile)'==''">$(Configuration)</TargetProfile>
       </PropertyGroup>
       <!-- Items for the project -->
       <ItemGroup>
        <ServiceDefinition Include="ServiceDefinition.csdef">
         <SubType>Designer</SubType>
        </ServiceDefinition>
        <None Include="ServiceDefinition.Debug.csdef">
         <SubType>Designer</SubType>
          <DependentUpon>ServiceDefinition.csdef</DependentUpon>
        </None>
        <None Include="ServiceDefinition.Demo.csdef">
         <SubType>Designer</SubType>
         <DependentUpon>ServiceDefinition.csdef</DependentUpon>
        </None>
        <None Include="ServiceDefinition.Release.csdef">
          <SubType>Designer</SubType>
          <DependentUpon>ServiceDefinition.csdef</DependentUpon>
        </None>
        <ServiceConfiguration Include="ServiceConfiguration.Debug.cscfg">
         <SubType>Designer</SubType>
        </ServiceConfiguration>
        <ServiceConfiguration Include="ServiceConfiguration.Demo.cscfg">
         <SubType>Designer</SubType>
        </ServiceConfiguration>
        <ServiceConfiguration Include="ServiceConfiguration.Release.cscfg">
         <SubType>Designer</SubType>
        </ServiceConfiguration>
       </ItemGroup>
      

      【讨论】:

      • 感谢您的建议,但我宁愿不将 Azure 服务配置绑定到构建配置。我将尝试在项目文件中对其进行硬编码,看看是否有任何不同。
      【解决方案3】:

      最好的办法是在你的项目的ccproj中更改服务配置前缀,添加yourprojectname.configurationname 点是救生员。

      <ServiceConfigurationPrefix>yourproject.ServiceConfiguration</ServiceConfigurationPrefix>
      

      将这些添加到项目组中:

      <ServiceDefinition Include="yourproject.ServiceDefinition.csdef" />
      <ServiceConfiguration Include="yourproject.ServiceConfiguration.cscfg" />
      

      确保您已从其所在文件夹重命名了 cscfg 文件。

      重新加载

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-17
        • 2017-03-16
        • 1970-01-01
        • 2016-12-06
        • 2023-02-09
        • 2023-02-02
        • 1970-01-01
        • 2019-06-04
        相关资源
        最近更新 更多