1

I've created a parameters.xml and verified that the xpath works with an online tool http://www.xpathtester.com/

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Website URL" description="Please provide the base web address for the external part of the application" defaultValue="https://someOtherSite.com">
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='ExternalSiteBaseUrl']/@value" />
  </parameter>
  <parameter name="Authentication Service URL" description="Please provide the web address for the authentication service" defaultValue="http://someOtherSite.com/auth">
    <paramterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='AuthServiceAddress']/@value" />
  </parameter>
</parameters>

When I import the zip file through IIS I get to the settings page with the connection strings, and these two options appear as expected. No matter what I set the values to though, they're just ignored. The value that is in the web.config remains unchanged. The connection string changes however are applied. In the summary that pops up afterwards there are a couple of lines saying that the connection strings were in scope, but there is nothing related to these two values. Is there a step I'm missing?

1 Answer 1

1

So the magic answer is that the scope declared here will find the first web.config which just happened to be an area in my MVC site. Because the parameter didn't exist there it was skipping and carrying on as normal

Sign up to request clarification or add additional context in comments.

3 Comments

So, do you remember how you fixed the problem? I'm experiencing the same issue now. Also, do you know if there is a way to get this kind of parameter included in the auto-generated SetParameters.xml file from the VS-2015 publish wizzard. (as it is now, it's overwritten each time I publish, and my custom parameters are lost.)
Hmm seems I was missing the /@value part, explaining why the value wasn't added. Works now with code similar to your example, just without \` in front of web.config$. Also I added <parameterValidation kind="AllowEmpty" />` to the <parameter> element.
Also, regarding my own question about how to get this into the result generated by the publishing wizard, I found out that I could add the <parameter> element to this file in the solution: /obj/Release/CSAutoParameterize.parameters.xml - it is then auto-added to the <project>.SetParameters.xml file as a <setParameter> element. In this case I recommend leaving the default value blank in the CSAutoParameterize.parameters.xml file, and adding the value to the <project>.SetParameters.xml file after publishing. More flexible that way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.