WebApplication publish to relative filesystem path

Solution 1:

For those using Visual Studio 2012 and the new publish configuration file (Properties/PublishProfiles/Local.pubxml) you can use this syntax in the file itself:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <SiteUrlToLaunchAfterPublish />
    <publishUrl>$(MSBuildThisFileDirectory)..\..\obj\publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
  </PropertyGroup>
</Project>

Be aware that the $(MSBuildThisFileDirectory) property will resolve to the Local.pubxml directory. From there you should traverse up to get where you need to be.

Solution 2:

Edit

For Visual Studio 2012, this solution will not work. You should look at the answer by michielvoo just after this one.

Original answer

After trying and trying I found the solution: you can use a relative path by setting

file:///./obj/publish

in the Publish WebApp dialog, but you must use a path that is already existent and writable by the user you are using. This way you can publish your web app in a local folder, or a path related folder.

Let me know if this helps. It did for me.