asp.net - Visual Studio 2017 ASP.Net 发布独立的 Dot Net Core 应用程序

标签 asp.net visual-studio .net-core publish visual-studio-2017

我在 Visual Studio 2017 中有一个 .Net Core ASP.Net 应用程序。我正在尝试对该应用程序进行独立部署。

如果我从 CLI 运行以下命令,它会完全按照我想要的方式工作并生成 .exe

dotnet publish -c release -r win7-x64

但是,如果我从 Visual Studio 2017 发布,它不会生成 .exe,而是生成 .dll。

如何从 Visual Studio 2017 中复制 dotnetpublish 命令的 -r win7-x64?

这是我的 .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>False</ExcludeApp_Data>
    <PublishFramework>netcoreapp1.1</PublishFramework>
    <ProjectGuid>74bc47dd-6787-420d-804f-3f3d689d5ae5</ProjectGuid>
    <publishUrl>C:\Deploy\JLM.MS.LeadGen.Dealer</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
  </PropertyGroup>
</Project>

最佳答案

此体验已添加到 Visual Studio 2017 版本 15.3 的发布窗口中(可以下载 here )

如果右键单击您的项目 -> 发布 -> 单击“摘要”下的“设置...”链接 -> 转到“发布”窗口的“设置”选项卡,您应该会看到一个目标运行时下拉列表,您可以在其中选择您希望应用程序运行的平台。 Here's我正在谈论的内容的屏幕截图。

确保在您的项目文件中包含您想要在 <RuntimeIdentifiers> 中选择的运行时或<RuntimeIdentifier> ,因为下拉列表会查找这些属性以填充其值。

关于asp.net - Visual Studio 2017 ASP.Net 发布独立的 Dot Net Core 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43728542/

相关文章:

c# - 带有 CosmosDBTrigger 的 Azure 函数似乎不是由 upsert 触发的

c# - 将 Collection 绑定(bind)到 ListView,抑制对象的重复但操作 ListViewItem

Javascript 在部分渲染后不执行

asp.net - RequiredFieldValidator 不能与 jQuery UI 一起正常工作

Asp.net GridView 列数

asp.net - 错误请求 - Visual Studio 2013 中的 Asp.net WebAPI 项目的主机名无效

windows - 运行特定版本的 Visual Studio(并排安装两个版本的 Visual Studio)

c# - 使用 Google Drive API [C#/.NET] 获取文件夹层次结构

c# - 在没有锁的情况下读取 bool 属性时的线程安全

c# - 在.net 6中,当服务初始化发生在值的配置绑定(bind)之前时,如何将参数传递给构造函数?