【发布时间】:2018-11-20 10:29:53
【问题描述】:
我有一个带有 asp.net mvc c# 站点的 VS 2012 解决方案,我正在使用它的发布配置文件和 msbuild 命令。在我的本地计算机上,文件被发布到发布配置文件中指定的目录,但在服务器上,它们转到项目 bin 目录。
我正在通过 MSBuild 运行以下命令:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe C:\WebSites\EMS.sln /p:Configuration=Release /p:DeployOnBuild=true /p:VisualStudioVersion=14.0 /p:AllowUntrustedCertificate=true /p:PublishProfile=C:\WebSites\EMSMVC\Properties\PublishProfiles\EMS_Auto.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 http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<Configuration>Release</Configuration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeFoldersFromDeployment>
Images
</ExcludeFoldersFromDeployment>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Apps\NEW_PUBLISH</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
我们使用的是 .NET Framework 4.5;我PC上的IIS版本是7.5; Visual Studio 12,高级版。
非常感谢任何帮助。
【问题讨论】:
-
我认为 PublishProfile 是要发布的配置文件的名称,而不是位置。 .pubxmlfile 的文件名
-
PublishProfile 可以是发布配置文件的名称,或者您也可以提供 .pubxml 文件的完整路径,但不应该存在问题,因为此命令在我的本地计算机上运行。
标签: c# asp.net-mvc-4 msbuild publish