2013-03-07 63 views
2

我有appSettings,我想在多個Web應用程序之間共享。所以在我的解決方案的根級,我創建了一個文件夾「Common ConfigSettings」。在這裏,我有 所有共享的appSettings。然後在不同的Web項目,我添加了一個鏈接到該文件,並引用像普通設置..web.config轉換 - appSettings節點不轉換

<appSettings file="../../Common ConfigSettings/sharedAppSettings.config"> 

這是運作良好,而調試。現在,當我需要發佈時,「鏈接」文件被複制到相關Web項目的目錄中,因此文件路徑需要立即更改,以指向與項目web.config相同的目錄。但我無法實現轉換。

我想轉換我的web.Config中的appSettings的「文件」屬性。但ID似乎並沒有工作。

原來的web.config

<appSettings file="../../Common ConfigSettings/sharedAppSettings.config"> 
</appSettings> 

變換

<appSettings file="sharedAppSettings.config" xdt:Transform="SetAttributes(file)" 
</appSettings> 

然後當我點擊預覽變換

<appSettings file="../../Common ConfigSettings/sharedAppSettings.config"> 
</appSettings> 
+0

給你的問題一個有意義的描述性標題,請。 – abatishchev 2013-03-07 09:01:29

回答

4

圍棋現在這個工作。只是刪除了 「(文件)」 從XDT:變換

變換

<appSettings file="sharedAppSettings.config" xdt:Transform="SetAttributes"> 
</appSettings> 

結果

<appSettings file="sharedAppSettings.config"> 
</appSettings> 

感謝

+0

翻看,我意識到我添加了xdt:Locator,但忘了添加xdt:Transform。哎呀:) – 2017-11-13 14:46:26