2017-05-02 59 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

相关问题