簡體   English   中英

web.config轉換-appSettings節點不轉換

[英]web.config transforms - appSettings node does not transform

我有要在多個Web應用程序之間共享的appSettings。 因此,在解決方案的根目錄下,我創建了一個文件夾“ Common ConfigSettings”。 在這里,我擁有所有共享的通用appSettings。 然后,在不同的Web項目中,我向該文件添加一個鏈接,並引用諸如..的通用設置。

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

在調試時,這很好用。 現在,當我需要發布時,“鏈接”文件被復制到相關Web項目的目錄中,因此文件路徑現在需要更改,以指向與項目web.config相同的目錄。 但是我無法使轉換生效。

我正在嘗試在web.Config中的appSettings上轉換“ file”屬性。 但是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>

現在工作了。 剛剛從xdt:transform中刪除了“(文件)”

轉變

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

結果

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

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM