2

我正在尝试覆盖相关 *.pubxml 中的“publishUrl”值

我尝试<publishUrl>在 pubxml.user 中使用,但没有成功。

可以在 *.pubxml.user 中使用哪些允许的属性?

我正在使用 Visual Studio Enterprise 2015 更新 1

这是我的 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>
4

1 回答 1

0

我无法在pubxml.user文件中专门执行此操作,但如果您想要特定于用户的包含来更改publishUrl,您可以通过自定义执行此操作Import

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

这将位于现有文件的底部。pubxml然后在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>

然后,您也可以轻松地.gitignore进行Local.pubxml.user.props操作。

于 2019-09-30T19:12:09.907 回答