2013-03-07 64 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