我在Visual 2013解决方案中使用SlowCheetah 2.5.10.6,在该解决方案中,我希望创建一个用于部署的web角色包。我正在使用Azure工具2.3。我的默认web.config转换工作正常。但是,SlowCheetah转换不起作用。不知何故,这应该是可行的:慢速猎豹第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。有人知道我在这里做错了什么吗?
发布于 2014-06-03 05:39:48
我用以下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文件中。WebRoleReferences和WebTargetDir变量是在Microsoft.WindowsAzure.targets中创建的。此脚本从csproj文件的OutputPath获取所有转换的配置文件,并将它们复制到用于创建Azure WebRole包的OutputDir中。
https://stackoverflow.com/questions/23995423
复制相似问题