2017-05-02 64 views
2

我在Visual Studio 2017中有一個.Net核心ASP.Net應用程序。我試圖做一個自包含的應用程序部署。Visual Studio 2017 ASP.Net發佈自包含Dot Net核心應用程序

如果我從CLI運行以下命令,它的工作原理正是我想和產生的.exe

dotnet publish -c release -r win7-x64 

但是,如果我從Visual Studio 2017年發佈它不會產生一個.exe和產生。而不是。

如何在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> 
+0

你能分享你的csproj嗎? – natemcmaster

回答

3

這方面的經驗已被添加到發佈窗口將Visual Studio的內容2017版本15.3(可下載here

如果您右鍵單擊您的項目 - >發佈 - >單擊「摘要」下的「設置...」鏈接 - >轉到發佈窗口的設置選項卡,您應該看到一個目標運行時下拉列表,您可以在其中選擇你希望你的應用程序運行的平臺。 Here's我在說什麼的截圖。

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

0

您需要

<OutputType>Exe</OutputType> 

添加到您的.csproj

+0

它已經在我的.csproj中。我需要將它添加到我的.pubxml中嗎? – jkruer01

+0

我不這麼認爲。添加輸出類型或運行時標識符後,您是否運行過'dotnet restore'? –

+0

是的,我做了dotnet恢復 – jkruer01

相關問題