Net发布自包含的点网核心应用程序

Net发布自包含的点网核心应用程序

本文介绍了Visual Studio 2017 ASP.Net发布自包含的点网核心应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a .Net Core ASP.Net application in Visual Studio 2017. I am trying to do a self contained deployment of the application.

如果我从CLI运行以下命令,它将按照我想要的方式正常工作并生成一个.exe

If I run the following command from the CLI it works exactly how I want and produces a .exe

dotnet publish -c release -r win7-x64

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

However if I publish from Visual Studio 2017 it does not produce a .exe and produces a .dll instead.

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

How can I replicate the -r win7-x64 of the dotnet publish command from within Visual Studio 2017?

这是我的.pubxml的内容

Here is the contents of my .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版的发布窗口中(可通过此处)

This experience has been added to the publish window for Visual Studio 2017 version 15.3 (which can be downloaded here)

如果右键单击项目->发布->单击摘要"下的设置..."链接->转到发布窗口的设置"选项卡,您应该会在其中看到目标运行时"下拉列表选择您要在其上运行应用程序的平台. 这是我正在谈论的内容的屏幕截图.

If you right click on your project -> Publish -> click the "Settings..." link under "Summary" -> go to the Settings tab of the Publish window, you should see a Target Runtime dropdown where you can choose which platform you want your app to run on. Here's a screenshot of what I'm talking about.

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

Make sure in your project file to include the runtime you want to select in <RuntimeIdentifiers> or <RuntimeIdentifier>, as the dropdown looks for these properties in order to populate its values.

这篇关于Visual Studio 2017 ASP.Net发布自包含的点网核心应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 07:24