views:

40

answers:

2

I'm editing my web.release.config file for production. I want the web.config file changed after a publish. I found how to change the web.config by using the web.release.config file properly, but not for this particular component.

The URL of an dynamic webservice has to change.

In the web.config:

<applicationSettings>
    <FooService.Properties.Settings>    
        <setting name="FooService_Student" serializeAs="String">  
            <value>http://testwebservices.foo.bar.nl/Student.asmx&lt;/value&gt;  
        </setting>  
        <setting name="FooService_User" serializeAs="String">  
            <value>http://testwebservices.foo.bar.nl/User.asmx&lt;/value&gt;  
         </setting>  
    </FooService.Properties.Settings>  
</applicationSettings>

now, how do I change the <value> in both settings? I tried the following, but that didn't work out:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
    <applicationSettings>
        <FooService.Properties.Settings>    
            <setting name="FooService_Student" serializeAs="String" xdt:Transform="Replace">  
                <value>http://webservices.foo.bar.nl/Student.asmx&lt;/value&gt;  
            </setting>  
            <setting name="FooService_User" serializeAs="String" xdt:Transform="Replace">  
                 <value>http://webservices.foo.bar.nl/User.asmx&lt;/value&gt;  
            </setting>  
        </FooService.Properties.Settings>  
    </applicationSettings>
 </configuration>

Anyone experience with this matter?

Thankyou!

A: 

How about adding a xdt:Locator="Match(name)", that will probably be what you need to find the exact nodes to replace.

Mikeware
A: 

Add xdt:Transform="Replace" to the applicationSettings tag.

<applicationSettings xdt:Transform="Replace"> 
<FooService.Properties.Settings>     
    <setting name="FooService_Student" serializeAs="String">   
        <value>http://webservices.foo.bar.nl/Student.asmx&lt;/value&gt;   
    </setting>   
    <setting name="FooService_User" serializeAs="String">   
        <value>http://webservices.foo.bar.nl/User.asmx&lt;/value&gt;   
     </setting>   
</FooService.Properties.Settings>   

DrZ