Visual Studio 2017 ASP.Net 发布独立的 Dot 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>
您需要添加
<OutputType>Exe</OutputType>
到您的 .csproj
此经验已添加到 window 发布 Visual Studio 2017 版本 15.3(可下载 here)
如果您右键单击您的项目 -> 发布 -> 单击 "Summary" 下的 "Settings..." link -> 转到发布 window 的设置选项卡,您应该会看到一个目标运行时下拉列表,您可以在其中选择您希望您的应用 运行 在哪个平台上运行。 Here's 我正在谈论的内容的屏幕截图。
确保在您的项目文件中包含您想要 select 到 <RuntimeIdentifiers>
或 <RuntimeIdentifier>
的 运行 时间,因为下拉列表会按顺序查找这些属性填充它的值。
我在 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>
您需要添加
<OutputType>Exe</OutputType>
到您的 .csproj
此经验已添加到 window 发布 Visual Studio 2017 版本 15.3(可下载 here)
如果您右键单击您的项目 -> 发布 -> 单击 "Summary" 下的 "Settings..." link -> 转到发布 window 的设置选项卡,您应该会看到一个目标运行时下拉列表,您可以在其中选择您希望您的应用 运行 在哪个平台上运行。 Here's 我正在谈论的内容的屏幕截图。
确保在您的项目文件中包含您想要 select 到 <RuntimeIdentifiers>
或 <RuntimeIdentifier>
的 运行 时间,因为下拉列表会按顺序查找这些属性填充它的值。