我正在VS 2017社区开发一个WPF应用程序 .
我已经下载了SlowCheetah,所以这是我的
App.Debug.config
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
App.Release.config
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
现在,无论我选择“调试”还是“发布”,app.config都没有任何变化 . 此外,单击预览转换为两个文件始终显示app.config原始内容 . 我哪里错了?
1 回答
您需要在配置文件上启用转换 . 右键单击您的项目,选择 Unload project . 再次右键单击选择 Edit xxx.csproj .
滚动到XML文件的底部 .
它应该看起来像:
插入以下XML:
所以它现在看起来像
右键单击选择 reload project . 重建 .
还要确保您的配置文件正确嵌套,它们应如下所示: