.NET Core Windows环境安装与体验

一、安装.NET Core SDK

在windows下开发.NET Core最好使用Visual Studio工具。下载地址与安装:git

.Net Core安装过程(安装过程比较慢,亲们耐心等待):github

5[`1BH9RU`XXV17Z8%2XMOGW1O(YN(RK2HKC598S{TGB7N9K7Y5CODQDYJ5B[[I)O@DUFimageimage(安装慢,等待中…….)imageimage(OK,终于安装完成了,开始下一步……) json

.Net Core可从https://www.microsoft.com/net/download下载: windows

image

VS Ent 2015 sp3效果图: app

AESN[ZN3RYWFKYXIX9@5{02

注意:工具

(1)VS2015能够使用免费开发工具Visual Studio Community或者Visual Studio Code。visual-studio

(2)安装以前首先确认Windows dependencies已安装。开发工具

(3)若是你使用本身喜欢的命令行工具或使用Visual Studio Code,你牢牢须要下载.NET Core SDK for Windows优化

~LC(8)S93[YT[O(E_`)E1NH

image

开发工具下载地址,可参考https://www.visualstudio.com/downloads/download-visual-studio-vs 网站

image

二、VS2015初始化代码

让咱们初始化一个Hello World应用程序。

开发环境VS Ent 2015与.Net Core 1.0 for Visual Studio

2.1 新建项目,选择.Net Core

image

注意:.Net Core支持最低版本是Framework 4.5。

2.2 选择Console Application

image

image

项目名称:FirstNetCore

点击“肯定”安装进行项目建立。

image

2.3 项目结构

image

可看到正在还原程序包。本过程嘛也要耐心等待……看到如下输出就算完成

log  : Writing lock file to disk. Path: c:\users\xxtt\documents\visual studio 2015\Projects\FirstNetCore\src\FirstNetCore\project.lock.json
log  : c:\users\xxtt\documents\visual studio 2015\Projects\FirstNetCore\src\FirstNetCore\FirstNetCore.xproj
log  : Restore completed in 124001ms.

解决方案:

image

Solution Items是全局配置文件目录:global.json,打开文件查看:

image

src目录是源文件存放与项目配置文件

image

2.4 修改Program.cs文件并编译运行

修改Program.cs文件:

image

按F5编译运行:

image

image

如下是调试输出结果:

“dotnet.exe”(CoreCLR: DefaultDomain): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Private.CoreLib.ni.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“c:\users\xxtt\documents\visual studio 2015\Projects\FirstNetCore\src\FirstNetCore\bin\Debug\netcoreapp1.0\FirstNetCore.dll”。已加载符号。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Runtime.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\mscorlib.dll”。没法查找或打开 PDB 文件。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Console.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Threading.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.IO.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.IO.FileSystem.Primitives.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Text.Encoding.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Text.Encoding.Extensions.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
“dotnet.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\System.Threading.Tasks.dll”。已跳过加载符号。模块进行了优化,而且调试器选项“仅个人代码”已启用。
程序“[4392] dotnet.exe: 程序跟踪”已退出,返回值为 0 (0x0)。
程序“[4392] dotnet.exe”已退出,返回值为 -1 (0xffffffff)。

三、使用命令行初始化代码

打开命令行,输入如下内容:(建立项目目录--转到项目目录--建立项目)

mkdir hwapp

cd hwapp

dotnet new

image

image

image

dotnet restore 重置project.json

image

dotnet run

image

按Enter键:

image

三、参考网站

https://www.microsoft.com/net/core#windows

相关文章
相关标签/搜索