我正在尝试在没有安装完整Visual Studio IDE的计算机上的PowerShell窗口中使用带有msbuild
命令的发布配置文件。我尝试过以下方法:
msbuild.exe .\Web.Admin.csproj /p:'DeployOnBuild=true;PublishProfile=Default;'
MSBuild.exe .\Web.Admin.csproj /p:PublishProfile=Default /p:VisualStudioVersion=14.0
msbuild.exe .\Web.Admin.csproj /p:PublishProfileRootFolder=C:\Users\username\Projects\Web\Web.Admin\Properties\PublishProfiles /p:PublishProfile=Default
在这两种情况下,发布配置文件似乎都被忽略了。这是由Visual Studio生成的发布配置文件(在Properties\PublishProfiles\Default.pubxml
中):
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\Sites\Test</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
</PropertyGroup>
</Project>
这些文件不会发布到指定的C:\Sites\Test
目录,因为如果我在Visual Studio 2017中使用发布命令运行它,那么它们将转到项目{{ 1}}目录。
MSBuild版本:14.0.23107.0