如何防止TransformXml构建任务替换换行符?

时间:2015-04-08 05:32:29

标签: configuration msbuild web-config transformation

我在项目文件中使用以下内容:

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
  <Target Name="AfterCompile" Condition="Exists('App.$(Configuration).config')">
    <!--Generate transformed app config in the intermediate directory-->
    <TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" />
    <!--Force build process to use the transformed configuration file from now on.-->
    <ItemGroup>
      <AppConfigWithTargetPath Remove="App.config" />
      <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
        <TargetPath>$(TargetFileName).config</TargetPath>
      </AppConfigWithTargetPath>
    </ItemGroup>
  </Target>

但是,如果我在多行上有配置项

<add key="MultiLine" value="option1,
    option2,
    option3 />

它转变为

 <add key="MultiLine" value="&#xD;&#xA;         option1,&#xD;&#xA;          option2,&#xD;&#xA;         option3/>

我该如何防止这种情况?

谢谢

赖安

0 个答案:

没有答案