Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# web.config XML文档转换在VS 2013中不起作用_C#_Xml_Xdt Transform - Fatal编程技术网

C# web.config XML文档转换在VS 2013中不起作用

C# web.config XML文档转换在VS 2013中不起作用,c#,xml,xdt-transform,C#,Xml,Xdt Transform,要为不同的环境自动化web.config转换,最好使用什么概念? 我有以下一个选项来做这件事。但还有比这项特殊和差别待遇更好的选择吗 我尝试使用XML文档转换概念为Test、Staging和PROD等环境生成配置文件,但生成的web.config并不反映Test/Staging/RPOD的更改 web.config xml: <?xml version="1.0" encoding="utf-8"?> <configuration> <connectio

要为不同的环境自动化web.config转换,最好使用什么概念? 我有以下一个选项来做这件事。但还有比这项特殊和差别待遇更好的选择吗

我尝试使用XML文档转换概念为Test、Staging和PROD等环境生成配置文件,但生成的web.config并不反映Test/Staging/RPOD的更改

web.config xml:

 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
    <connectionStrings>
        <add name="personalDB"
              connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyDevReleaseDB;Integrated Security=True" />
   </connectionStrings>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
   </system.web>
  <system.webServer>
     <defaultDocument>
       <files>
         <add value="lists.html" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>
下面是Web.PROD.config,其中包含xdt关键字,该关键字显示在configuration manager中的活动解决方案配置中

 <?xml version="1.0" encoding="utf-8"?>               
 <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">      
     <connectionStrings>
       <add name="personalDB" 
         connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleasePRODDB;Integrated Security=True" 
         xdt:Transform="Replace" xdt:Locator="Match(name)"/>
   </connectionStrings>
   <system.web>
      <compilation xdt:Transform="RemoveAttributes(debug)" />
   </system.web>
 </configuration>

我做错了什么?

我试图构建解决方案并验证web.config,这不是检查转换后的web.config的正确方法


当我使用所选的生成配置并通过在本地iis上单击“发布到本地主机”来部署Web应用程序时,会转换Web.config文件。

是否进行了测试\prod\staging生成配置?是的,我已经生成了它。更新了我的帖子。