msdeploy + setParameters.xml, how to set web physical file location

南笙酒味 提交于 2019-12-21 18:57:51

问题


This question has been danced around a bit, forgive me if it is a duplicate but I haven't been able to find an exact answer.

I am trying to create a Parameters.xml for deployment configuration that specifies the destination physical file folder for a web site. This is for an automated build using TeamCity, e.g. commandline using .deploy.cmd.

Can someone explain what I need to do?

Parameters.xml:

<parameter name="physicalPathLocation" description="Physical path where files for this Web service will be deployed." defaultValue="\" tags="PhysicalPath">
    <parameterEntry kind="DestinationVirtualDirectory" scope="Default\ Web\ Site/iag\.application\.services\.exampleservice/" match="" />
</parameter>

And in SetParameters.xml

<setParameter name="physicalPathLocation" value="C:\MyFolder\MySite" />

I suspect my problem is in how I am declaring the scope but am unsure what needs to be done.


回答1:


Assuming Default Web Site/iag.application.services.exampleservice is a virtual directory in IIS (DestinationVirtualDirectory is only valid for "applications"), you can probably just get away with removing the / suffix and not encoding it. (I've also removed the match attribute)

<parameter name="physicalPathLocation" 
           description="Physical path where files for this Web service will be deployed." 
           defaultValue="\" 
           tags="PhysicalPath"
           >
    <parameterEntry kind="DestinationVirtualDirectory" 
                    scope="Default Web Site/iag.application.services.exampleservice" />
</parameter>

Keep in mind that you don't have to declare parameters before you set them. You could just as easily declare the full parameter and set it at the same time:

<setParameter name="physicalPathLocation" 
              kind="DestinationVirtualDirectory" 
              scope="Default Web Site/iag.application.services.exampleservice" 
              value="C:\MyFolder\MySite" />


来源:https://stackoverflow.com/questions/12378931/msdeploy-setparameters-xml-how-to-set-web-physical-file-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!