【发布时间】:2017-07-22 02:11:55
【问题描述】:
我有一个项目可以在我们的构建服务器(2012 年)上无错误地构建。问题是我们没有得到转换后的 app.config。
使用转换预览,我看到转换工作正常。在 .csproj 文件中,我看到添加了 app.config 和所有转换,并且构建时转换设置为 true。
<ItemGroup>
<None Include="App.config">
<TransformOnBuild>true</TransformOnBuild>
</None>
<None Include="App.Debug.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App.DEV1.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App.PROD.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App.QA1.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App.Release.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App.UAT1.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
构建中的其他项目具有正确的配置文件。这是构建日志的相关部分。
10:53:46.166 66>Target "_CopyAppConfigFile: (TargetId:2226)" in file "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets" from project "D:\1_91\Sources\Path1\Path2\Path3\projname.csproj" (target "CopyFilesToOutputDirectory" depends on it):
Building target "_CopyAppConfigFile" completely.
Output file "D:\1_91\Binaries\Path3\projname.exe.config" does not exist.
Task "Copy" (TaskId:1543)
Copying file from "App.config" to "D:\1_91\Binaries\Path3\projname.exe.config". (TaskId:1543)
Done executing task "Copy". (TaskId:1543)
它没有找到转换后的配置,因此将其替换为默认配置。我可以尝试什么来解决这个问题?
【问题讨论】:
-
我使用的是Slow Cheetah,到目前为止它对所有事情都有效。所以我安装了marketplace.visualstudio.com/… 并将转换指令添加到项目中。现在可以了。
标签: msbuild transform app-config