문제

sorry for such kind of question but I've spent too much time on it. I have an app.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <userSettings>
    <tbp.qa.Properties.Settings>
      <setting name="ServiceUri" serializeAs="String">
       <value>localhost</value>
     </setting>
   </tbp.qa.Properties.Settings>
 </userSettings>
</configuration>

How to change the 'value' with config transformation, I have tried the following and it doesn't change anything:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <userSettings>
    <tbp.qa.Properties.Settings>
      <add name="ServiceUri" xdt:Transform="Replace" xdt:Locator="Match(name)">
        <value>localhost1</value>
      </add>
    </tbp.qa.Properties.Settings>
  </userSettings>
</configuration>

What am I doing wrong?

도움이 되었습니까?

해결책

Your config file transformation XML structure should match original config file's XML structure.

So in your config you have the element with the name setting but in your transformation file you have the element with the name add.

So change your transformation element from add to setting and it should work

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <userSettings>
    <tbp.qa.Properties.Settings>
      <setting name="ServiceUri" xdt:Transform="Replace" xdt:Locator="Match(name)">
        <value>localhost1</value>
      </setting>
    </tbp.qa.Properties.Settings>
  </userSettings>
</configuration>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top