Web Deployment - Using Relative Paths to Deploy the Local File System

I want to use Web Deploy to run a custom deployment installation.

Since I want this work to be great when working in many different environments (local teams of group members, 4 different build servers), I want to deploy a local path that is relative.

What I want to do is:

  • Expand the local relative path
  • After the build is complete, do magical things ...

However, when I enter the local file path for deployment as: ".. \ Deploy_Production"

web deployment complains about this:

2>Connecting to ..\Deploy_Live... 2>Unable to create the Web site '../Deploy_Live'. The URL http://:0 is invalid. 

As if the web deployment considers the relative path to the file to be the URL of the website. Using ".." instead does not help my reason.

How to get WebDeploy to deploy a local relative path?

Change 1:

I tried using the ConvertToAbsolutePath task before building, to no avail:

  <PropertyGroup> <WebPublishMethod>FileSystem</WebPublishMethod> <SiteUrlToLaunchAfterPublish>http://mywebsite.com</SiteUrlToLaunchAfterPublish> <publishUrl>..\Deploy_Production</publishUrl> <DeleteExistingFiles>False</DeleteExistingFiles> </PropertyGroup> <Target Name="BeforeBuild"> <ConvertToAbsolutePath Paths="$(publishUrl)"> <Output TaskParameter="AbsolutePaths" PropertyName="publishUrl" /> </ConvertToAbsolutePath> </Target> 

Edit 2: The above works, but only when you run the command line for the solution file is not a project file

+24
msbuild webdeploy msdeploy
Aug 19 2018-12-12T00:
source share
1 answer

We have an error here, when publishing using the file system, you must provide the full path. We actually discovered this error this week. This will be fixed in our next update. In this case, when the relative path is passed, it incorrectly considers its path to be IIS.

As a workaround, you can edit .pubxml to make publishUrl the full path. Fortunately, you can use the MSBuild property to make this work in command scripts. Here's what you should do, edit the .pubxml file and update the publishUrl value as follows.

 <publishUrl>$(MSBuildThisFileDirectory)..\..\..\Deploy_Production</publishUrl> 

This path will refer to the .pubxml file itself. I have verified that this works both from the command line and from the publish dialog. If you have any problems with this, let me know, but the fix, I hope, will be released in a few months [no guarantees, of course :)].

+38
Aug 19 '12 at 18:44
source share



All Articles