我在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>
答案 0 :(得分:3)
此体验已添加到Visual Studio 2017版本15.3的发布窗口中(可以下载here)
如果您右键单击您的项目 - &gt;发布 - &gt;点击&#34;设置...&#34;链接&#34;摘要&#34; - &GT;转到“发布”窗口的“设置”选项卡,您应该会看到“目标运行时”下拉列表,您可以在其中选择要在其上运行应用的平台。 Here's我正在谈论的截图。
确保在项目文件中包含要在<RuntimeIdentifiers>
或<RuntimeIdentifier>
中选择的运行时,因为下拉列表会查找这些属性以填充其值。
答案 1 :(得分:0)
您需要添加
<OutputType>Exe</OutputType>
到您的.csproj