Search code examples
visual-studio-2010xpathmsbuildmsdeploy

MSBuild Paramaters.xml xpath appsettings file attribute


Im using msbuild to create a web deploy package using the parameters.xml file to replace web.config settings.

Im trying to replace the appsettings file attribute in web.config

This is my parameters.xml:

<parameter name="ClientConfig" description="Please enter the clients config file name." defaultValue="Niad.config" tags="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/setting[@name='file']/value" />
 </parameter>

This is my Web.config section:

<?xml version="1.0"?>
<configuration>
 <appSettings file="Client.config">
 </appSettings>
</configuration>

I know I'm writing the xpath match incorrectly, I was hoping someone could help me with the correct syntax.


Solution

  • This worked:

    match="/configuration/appSettings/@file"
    
    <parameter name="ClientConfig" description="Please enter the clients config file name." defaultValue="Niad.config" tags="">
    <parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/@file" />
    </parameter>