SlowCheetah Azure Web角色未转换

时间:2014-06-02 13:13:51

标签: azure msbuild slowcheetah

我在Visual Studio 2013解决方案中使用SlowCheetah 2.5.10.6,我想在其中创建用于部署的Web角色包。我正在使用Azure Tools 2.3。 我的默认web.config转换工作正常。但是,SlowCheetah变换不起作用。不知何故,这应该有效:Slow Cheetah issue 5 在我的输出窗口中,我看到以下内容:

1>Task "SlowCheetah.Xdt.TransformXml"
1>  Transfroming source file: D:\web\Project\src\Project.Web\App_Config\OTAP\connectionStrings.config
1>  Applying Transform File: App_Config\OTAP\connectionStrings.O.config
1>  Output File: bin\App_Config\OTAP\connectionStrings.config
1>Done executing task "SlowCheetah.Xdt.TransformXml".

在我的bin文件夹中,我看到了正确转换的文件。

我在输出中也看到以下行:

3>  Task "Message"
3>      TransformedWebFiles = App_Config\OTAP\connectionStrings.config, DestinationRelativePath=App_Config\OTAP\connectionStrings.config, Exclude=False, FromTarget=CollectFilesFromContent, Category=Run, ProjectFileType=Default

但是在创建包时,会使用原始文件

3>Target "CopyWebRoleFiles" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets" from project "D:\web\Project\src\Project\Project.ccproj" (target "CopyRoleFiles" depends on it):
3>  Task "Message"
3>      CurrentRoleWebFiles=D:\web\Project\src\Project.Web\App_Config\OTAP\appSettings.config -> App_Config\OTAP\appSettings.config
3>  Task "Message"
3>      CurrentRoleWebFiles=D:\web\Project\src\Project.Web\App_Config\OTAP\connectionStrings.config -> App_Config\OTAP\connectionStrings.config

所以我的基本配置在包中使用,我想要使用connectionStrings。*。config。 有谁知道我在做错了什么?

1 个答案:

答案 0 :(得分:3)

我使用以下MSBuild脚本修复了问题:

<Target Name="DeploySlowCheetahTransforms" AfterTargets="CopyWebRoleFiles" Condition="'@(WebRoleReferences)' != ''">
    <PropertyGroup>
      <IntermediateWebOutputPath>%(WebRoleReferences.OutputDir)</IntermediateWebOutputPath>
    </PropertyGroup>
    <ItemGroup>
        <TransformedFiles Include="$(WebTargetDir)\**\*.config" Exclude="$(WebTargetDir)\**\*.dll.config;$(WebTargetDir)\**\web*.config" />
    </ItemGroup>
    <Copy SourceFiles="@(TransformedFiles)" DestinationFiles="@(TransformedFiles->'$(IntermediateWebOutputPath)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

此脚本需要添加到ccproj文件中。 WebRoleReferencesWebTargetDir变量是在Microsoft.WindowsAzure.targets中创建的。此脚本从csproj文件的OutputPath获取所有已转换的配置文件,并将它们复制到OutputDir,后者用于创建Azure WebRole包。

相关问题