转换App.Config

问题描述 投票:0回答:1

我目前正在改造项目中的配置文件。

Debug配置如下:

<appSettings file="C:\MyPath\debug.config"></appSettings>

发布看起来像这样:

<appSettings  file="C:\MyPath\release.config"></appSettings>

我的目标是根据构建配置文件切换文件位置。

我找不到在发布版本中转换文件值的方法。

参考类似的解决方案或文档将是非常棒的。

c# xml app-config
1个回答
1
投票

我发现它是如何完成的:

我不得不在App.Release.config中使用xdt:Transform="SetAttributes(file)"

像这样:

<appSettings  file="C:\MyPath\release.config" xdt:Transform="SetAttributes(file)"></appSettings>

这将仅更改文件值

© www.soinside.com 2019 - 2024. All rights reserved.