How do I override the publishUrl value from *.pubxml from a *.pubxml.user?

743 Views Asked by At

I'm trying to override the "publishUrl" value in the related *.pubxml

I tried using <publishUrl> in pubxml.user but it doesn't pick that up.

What are the allowed properties that can be used in *.pubxml.user?

I'm using Visual Studio Enterprise 2015 Update 1

here's my pubxml:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>C:\Developments\gsvc\Website</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>
1

There are 1 best solutions below

0
On

I wasn't able to do this in the pubxml.user file specifically, but if you'd like a user-specific include for changing the publishUrl, you can do this via a custom Import:

<Import Project="Local.pubxml.user.props" Condition="Exists('Local.pubxml.user.props')" />

This would be at the bottom of the existing pubxml file. And then in Local.pubxml.user.props:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <publishUrl>C:\custom\Website</publishUrl>
  </PropertyGroup>
</Project>

You can then easily .gitignore the Local.pubxml.user.props as well.