簡體   English   中英

Visual Studio 2017 ASP.Net發布自包含的點網核心應用程序

[英]Visual Studio 2017 ASP.Net Publish Self-Contained Dot Net Core App

我在Visual Studio 2017中有一個.Net Core ASP.Net應用程序。我正在嘗試對該應用程序進行獨立部署。

如果我從CLI運行以下命令,它將完全按照我想要的方式工作並生成.exe

dotnet publish -c release -r win7-x64

但是,如果我從Visual Studio 2017發布,它不會生成.exe,而是生成.dll。

如何在Visual Studio 2017中復制dotnet publish命令的-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版的發布窗口中(可在此處下載)

如果右鍵單擊項目->發布->單擊“摘要”下的“設置...”鏈接->轉到“發布”窗口的“設置”選項卡,您應該會看到“目標運行時”下拉列表,您可以在其中選擇平台您希望您的應用繼續運行。 是我在說的屏幕截圖。

確保在項目文件中包含要在<RuntimeIdentifiers><RuntimeIdentifier>選擇的運行時,因為下拉列表會查找這些屬性以填充其值。

您需要添加

<OutputType>Exe</OutputType>

到您的.csproj

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM