dotnet Core 2.0学习笔记(一)

一:Dotnet Core Windows运行环境,标红部分要注意

https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x

.NET Core supported Windows versions

.NET Core is supported on the following versions of :

  • Windows 7 SP1
  • Windows 8.1
  • Windows 10, Windows 10 Anniversary Update (version 1607) or later versions
  • Windows Server 2008 R2 SP1 (Full Server or Server Core)
  • Windows Server 2012 SP1 (Full Server or Server Core)
  • Windows Server 2012 R2 (Full Server or Server Core)
  • Windows Server 2016 (Full Server, Server Core, or Nano Server)

See .NET Core 2.x - Supported OS Versions for the complete list of .NET Core 2.x supported operating systems.

See .NET Core 1.x Supported OS Versions for the complete list of .NET Core 1.x supported operating systems.

.NET Core dependencies

.NET Core 1.1 and earlier requires the Visual C++ Redistributable when running on Windows versions earlier than Windows 10 and Windows Server 2016. This dependency is automatically installed by the .NET Core installer.

Microsoft Visual C++ 2015 Redistributable Update 3 must be manually installed when:

  • Installing .NET Core with the installer script.
  • Deploying a self-contained .NET Core application.

Note

For Windows 7 and Windows Server 2008 machines only:
Make sure that your Windows installation is up-to-date and includes hotfix KB2533623 installed through Windows Update.

 

二:Dotnet Core程序发布

应用程序的发布,大概可以理解为两种情况,一种是依赖运行时的发布,另一种是不依赖全局.net core运行环境,“Self-contained”,即把所有依赖打包到一起的方式。

第一种方式比较普遍,发布到用户环境时,先安装.net core 的runtime,再把应用程序复制到客户机,即完成部署。

第二种方式特殊一点,需要在发布时,将所依赖的运行环境,一起打包到发布目录中。按照官方说明,修改csproj 项目文件,指定目标环境的Runtime Identifier (RID) ,如下:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeIdentifiers>win7-x64;osx.10.11-x64</RuntimeIdentifiers>
</PropertyGroup>
</Project>

然后可以在.net core CLI中或者Vs中,进行项目的发布。

我的发布目标为Windows server 2008 R2,对应RID为win7-x64,发布后的目录:RtuServer\bin\Release\Win2008R2,运行RtuServer.exe成功。

 

posted @ 2017-11-27 14:58  Perfectionist  阅读(262)  评论(0编辑  收藏  举报