xmltfswebdeploypubxml

WebDeploy TFS 2017 -All arguments must begin with "-"


My build runs fine creates the .zip packages but i get the All arguments must begin with "-" upon Release error in logs.

WHAT I DID SO FAR: I have created a .pubxml file it works but i think i am trying to pass the parameters wrong.

QUESTION: I saw that there is a way of creating seperate parameters.xml file in the root of the project but I dont understand how to do it and how it works. Any help would be appreciated.

UPDATE Just found out that the parameters.xml are being generated inside the .zip package But i still dont know how to assign them.

 <PreSource Path="Url=http://Somepath/spath/pathh.svc; Domain=somedomain; Username=someusernam; Password=somepass;" includeData="False" />

Solution

  • Web Deploy parameters are useful when you have to create a package without knowing some of the values that will be needed when the package is installed

    It seems that you want replace the Url in the web.config file.

    1. Create a Parameters.xml file under your project in Visual Studio.

    Code:

     <parameters>
          <parameter name="DemoUrl" description="Please enter the name of the Environment" defaultvalue="_UrlValue_" tags="">
            <parameterentry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='DemoUrl']/@value">
            </parameterentry>
          </parameter>
        </parameters>
    
    1. Create a .pubxml file to deploy. Then do a publish in your local VS. Check if there's a projectname.SetParameters.xml file generated.

    2. Check in the Parameters.xml together with your project to TFS.

    3. In TFS build, build your project to generate .zip packages.

    4. In TFS release, add a Replace token step to replace the Url value in projectname.SetParameters.xml file. Create a variable named 'DemoUrl' in release definition, and the value of this variable you enter in will replace 'UrlValue'.

    enter image description here

    1. Add the deploy step. Maybe you use msdeploy to install packages, the Url in web.config file will be replace with what you set to 'DemoUrl' variable in release definition.

    For more information, you could refer to: http://andrew.lansdowne.me/2016/12/15/using-environment-variables-for-configuration-with-vsts-build-and-release/