2016-09-17 25 views
0

我發現了一些類似的問題,但似乎沒有任何幫助。發佈後未應用Web.Config轉換

我在我的web.config以下:

<appSettings configSource=".\ConfigDEV\AppSettings.xml" /> 
    <connectionStrings configSource=".\ConfigDEV\ConnectionStrings.xml" /> 
    <applicationSettings> 
    <StarLight.Properties.Settings configSource=".\ConfigDEV\TaxonomySettings.xml" /> 
    <Stikeman.MatterDB.Library.Properties.Settings configSource=".\ConfigDEV\MatterDBSettings.xml" /> 
    </applicationSettings> 

我已經在我的Web.Release.config如下:

<appSettings configSource="__AppSettingsPath__" xdt:Transform="Replace" xdt:Locator="Match(configSource)" /> 
    <connectionStrings configSource="__ConnectionStringsPath__" xdt:Transform="Replace" xdt:Locator="Match(configSource)" /> 
    <applicationSettings> 
    <StarLight.Properties.Settings configSource="__TaxonomySettingsPath__" xdt:Transform="Replace" xdt:Locator="Match(configSource)" /> 
    <Stikeman.MatterDB.Library.Properties.Settings configSource="__MatterDBSettingsPath__" xdt:Transform="Replace" xdt:Locator="Match(configSource)" /> 
    </applicationSettings> 

如果我發佈在VS2015的解決方案(使用發佈命令),web.config不會被轉換,並且原始的configSource值仍然存在。

我在這裏錯過了什麼?

任何幫助表示讚賞。

感謝, KS

回答

0

爲了替代configSource你應該刪除XDT:定位器。您可以通過右鍵單擊。\ ConfigDEV \ AppSettings.xml文件並選擇預覽轉換進行測試。

<appSettings configSource="__AppSettingsPath__" xdt:Transform="Replace" /> 
    <connectionStrings configSource="__ConnectionStringsPath__" xdt:Transform="Replace" /> 
    <applicationSettings> 
    <StarLight.Properties.Settings configSource="__TaxonomySettingsPath__" xdt:Transform="Replace" /> 
    <Stikeman.MatterDB.Library.Properties.Settings configSource="__MatterDBSettingsPath__" xdt:Transform="Replace" /> 
    </applicationSettings> 

我有同樣的問題,不得不刪除定位器,以獲得更換。

+0

謝謝 - 似乎工作! – Perplexed