2016-07-06 63 views
0

使用VS 2k15,ASP.NET 4.5 我的变换不起作用。我正在预览,文件是相同的。然后我想,也许我必须部署才能看到转型。因此,我使用“部署配置”设置了自定义的部署到我的桌面。发布后检查web.config,仍然匹配原始。Web.Config转换不工作

任何想法我做错了什么?

我知道当我预览我会在写着预览顶部的警告......”

These files have different encodings. Left file: Unicode (UTF-8) without signature. Right file: Unicode (UTF-8) with signature. You can resolve the difference by saving the right file with the encoding Unicode (UTF-8) without signature. 

然而,当我选择保存选项并保存部署没有签名文件(所以他们匹配)的消息还是来了。只是不知道是怎么回事。任何想法,为什么我不能改变这个工作?

的Web.Config

<?xml version="1.0" encoding="utf-8"?> 
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

    <appSettings> 
     <add key="fileLibrary" value="c:\vsoProjects\localFiles\rlFileLibrary" /> 
    </appSettings> 

    <connectionStrings> 
     <add name="appConnString" connectionString="Data Source=(LocalDb);Initial Catalog=DevDB;User ID=*****;Password=*****;Connect Timeout=300" /> 
    </connectionStrings> 

</configuration> 

Web.ContDeploy.Confi摹

<?xml version="1.0" encoding="utf-8"?> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 

    <appSettings> 
     <add key="fileLibrary" value="R:\rlFileLibrary" xdt:Transform="Replace" xdt:Locator="Match(key)"/> 
    </appSettings> 

    <connectionStrings> 
     <add name="appConnString" connectionString="Data Source=myserver.test.com;Initial Catalog=DeployDB;User ID=*****;Password=*****;Connect Timeout=300" xdt:Transform="SetAttributes(connectionString)" xdt:Locator="Match(name)"/> 
    </connectionStrings> 

    <system.web> 
     <compilation xdt:Transform="RemoveAttributes(debug)" />  
    </system.web> 

</configuration> 
+0

您可以显示配置管理器窗口的屏幕截图吗? –

回答

0

我不是在转换方面的专家,但我的(工作)转换为关键的appSettings有这样的签名:

<appSettings> 
    <add key="datafolder" value="D:\sites\removedpath\App_Data\" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> 
    </appSettings> 

比你

0

我略有不同发现问题。这个项目从asp.net 2.x转换到4.5。

web.config仍然在配置部分有一个属性。

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
... 
</configuration> 

你可以在我发布的代码中看到它。我没有意识到它仍然存在。毕竟那时候我的头撞到了我的桌子上,我刚刚删除了那个属性,预览变换,并且它在那里!也正确部署。