0

我有这个我想从我的 app.config 中交换。被交换的是价值。我将如何在我的 app.sys.config 中编写它?

 <userSettings>   
   <Ska.Base.Properties.Settings>
     <setting name="DataSource" serializeAs="String">
        <value>nc2221.rsss.st</value>
     </setting>
</Ska.Base.Properties.Settings>

<Ska.Properties.Settings>
  <setting name="Plu_DnsName" serializeAs="String">
    <value>10.11.10.113</value>
  </setting>
</Ska.Properties.Settings>
</userSettings>

这就是转换后我的应用程序中应该有的内容

<userSettings>   
   <Ska.Base.Properties.Settings>
     <setting name="DataSource" serializeAs="String">
        <value>nb2222.rsss.st</value>
     </setting>
</Ska.Base.Properties.Settings>

<Ska.Properties.Settings>
  <setting name="Plu_DnsName" serializeAs="String">
    <value>10.33.20.123</value>
  </setting>
</Ska.Properties.Settings>
</userSettings>

这就是我想使用它的方式。但我不明白该怎么做。 http://msdn.microsoft.com/en-us/library/dd465326.aspx

因为字符串在参数(值)之外

这会起作用,但这不是我所追求的。(属性与属性)

<userSettings>   
<Ska.Base.Properties.Settings>
  <setting name="DataSource" 
            serializeAs="String"
            value="<userSettings>   
<Ska.Base.Properties.Settings>
  <setting name="DataSource" 
            serializeAs="String"
            value="nc2221.rsss.st"
            xdt:Transform="SetAttributes" 
            xdt:Locator="Match(name)"/>
</Ska.Base.Properties.Settings>

 <Ska.Properties.Settings>
  <setting name="Plu_DnsName" 
            serializeAs="String"
            value = "10.11.10.113"
            xdt:Transform="SetAttributes" 
            xdt:Locator="Match(name)"/>
 </Ska.Properties.Settings>
  </userSettings>
4

1 回答 1

2

最后我找到了答案:

 <userSettings>   
<Ska.Base.Properties.Settings>
<setting name="DataSource" 
        serializeAs="String"
        value="<userSettings>   
<Ska.Base.Properties.Settings>
<setting name="DataSource" 
        serializeAs="String"
        xdt:Transform="SetAttributes" 
        xdt:Locator="Match(name)">
  <value xdt:Transform="Replace">nc2221.rsss.st</value>
  </setting>
</Ska.Base.Properties.Settings>

<Ska.Properties.Settings>
 <setting name="Plu_DnsName" 
        serializeAs="String"
        xdt:Transform="SetAttributes" 
        xdt:Locator="Match(name)">
  <value xdt:Transform="Replace">10.11.10.113</value>
 </setting>
</Ska.Properties.Settings>
</userSettings>
于 2014-06-18T06:36:54.800 回答