我有一个如下的 XML 文件
<?xml version="1.0"?>
<appSettings xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="Key1" value="TransformValue1"/>
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="Key2" value="TransformValue2"/>
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="Key3" value="TransformValue3"/>
<add xdt:Transform="Replace" xdt:Locator="Match(key)" key="Key4" value="TransformValue4"/>
<add xdt:Transform="Insert" key="Key6" value="TransformValue6"/>
</appSettings>
我想将此 XML 作为类键列表。这里的Key类如下
[Serializable]
public class Key
{
public string Key { get; set; }
public string Value { get; set; }
public string Transform { get; set; }
public string Locator { get; set; }
}
请建议
大家好,为了更好地理解我的问题,我有目的地更新问题。
目的: 作为自动部署的一部分,我们还计划自动部署 web.config 文件。为了实现这个过程,我们使用了“Web config transform”的概念。为了实现这种“Web 配置转换”,我们将在集中式服务器中维护转换文件(用于所有实例和客户端),这些文件将用于转换。但是为了更新转换文件,我们为部署团队成员提供了 Ui。为此,我们需要读取带有名称空间的 XML 配置。