【问题标题】:MsBuild command ignoring location in publish profileMsBuild 命令忽略发布配置文件中的位置
【发布时间】: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


【解决方案1】:

我不确定这是否是一个通用解决方案,但我在现场看到了类似的东西,使用它并解决了我们的问题:因为用于在本地编辑和部署的 Visual Studio 是,正如我提到的,VS 2012 或版本 11,我必须将文件夹 Web 从本地 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web 复制到服务器上的位置:C:\Program Files (x86)\MSBuild\Microsoft \VisualStudio\v14.0\(只有 WebApplications 文件夹),现在可以正常工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 2022-07-24
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多