1

Is there a way to remove parameters from the generated SetParameters.xml within an MSDeploy package.

My Parameters.xml looks like this:

<parameter name="Server" defaultValue="" />
<parameter name="Directory" defaultValue="" />
<parameter name="Service URL" defaultValue="http://{Server}/{Directory}/Services/GeneralIntegrationService.svc" tags="hidden">
<parameterEntry kind="XmlFile" scope="Web.config" match="//system.serviceModel/client/endpoint[@name='BasicHttpBinding_IGeneralIntegrationService']/@address" />

what I want is the generated SetParameters.xml to only contain the first 2 parameters.

I've reviewed this question: Can MSBuild exclude "Hidden" Web Deploy parameters from the generated SetParameters.xml?

however, I can't get my head around how the .targets file is supposed to set up. Can someone detail a complete example of what the parameters.xml and the .targets file looks like. Also, is there anything I need to set in the build properties of the .targets file?

Community
  • 1
  • 1
Martin
  • 2,180
  • 4
  • 21
  • 41
  • Why not do the stuff you don't want as parameters in a config-transform? – cederlof Nov 20 '13 at 15:38
  • The idea is to create a package, easily, using msbuild, that can be deployed via the webui, or using the setparameters. This allows the user to compare 2 setparameters files to see changes in a new version. I'm not sure how you would achieve that with transforms, but the answer fits I'll accept it.. – Martin Nov 20 '13 at 20:08

1 Answers1

1

I don't think the SetParameters-method is designed to be used that way. I would use config-transforms for parameters you want to hide from the person installing the application.

Edit Actually, for your scenario, you could do a "search and replace" in the Web.config to get the desired result

In your parameters.xml

<parameters>
    <parameter name="Server" description="" defaultValue="" tags="">
        <parameterEntry kind="TextFile" scope="\\web.config$" match="@@Server@@" />
    </parameter>
    <parameter name="Directory" description="" defaultValue="" tags="">
        <parameterEntry kind="TextFile" scope="\\web.config$" match="@@Directory@@" />
    </parameter>
</parameters>

And where you need the endpoint address in the Web.Config, just put the URL like this:

http://@@Server@@/@@Directory@@/Services/GeneralIntegrationService.svc
cederlof
  • 7,206
  • 4
  • 45
  • 62
  • I'll need a bit more information, possibly an example, if I am to accept this. I did manage to do it through .targets eventually, but your solution does sound interesting – Martin Nov 21 '13 at 16:08
  • @Martin I just added another, dead simple solution. – cederlof Nov 22 '13 at 09:52
  • That looks perfect, is their documentation on this, struggling to find any. – Martin Nov 29 '13 at 11:42