Windows 下开发.NET Core应用

一、使用Visual Studio 2015开发
1.1 依次安装
Visual Studio 2015 Update 3
.NET Core 1.0.0 - VS 2015 Tooling Preview 2
1.2 IDE中新建.NET Core项目,使用Nuget管理器,这些大家就都熟悉啦
1.3 发布应用,写好的程序要发布到服务器上这是必需的
解决方案管理器》要发布项目》右键》发布》选择文件系统,就会发布到本地的bin\Debug\PublishOutput目录啦
二、使用命令行方式开发
如果觉得前一种方式不爽,不想安装那么大的VS2015,那就用这种方式吧
2.1 安装.NET Core SDK for Windows和Visual Studio Code(以下简称Code)
2.2 使用命令行创建一个项目
mkdir HelloWorldApp
cd HelloWorldApp
dotnet new
2.3 打开Code,安装C#扩展,打开HelloWorldApp目录,对C#代码进行编辑
2.3 编译运行
::恢复Nuget包
dotnet restore
::编译运行
dotnet run
2.4 发布
dotnet publish

 

附:dotnet命令(全名:Microsoft .NET Core Shared Framework Host)

C:\>dotnet --help
.NET Command Line Tools (1.0.0-preview2-003121)
Usage: dotnet [host-options] [command] [arguments] [common-options]

Arguments:
[command] The command to execute
[arguments] Arguments to pass to the command
[host-options] Options specific to dotnet (host)
[common-options] Options common to all commands
Common options:
-v|--verbose Enable verbose output
-h|--help Show help
Host options (passed before the command):
-v|--verbose Enable verbose output
--version Display .NET CLI Version Number
--info Display .NET CLI Info
Common Commands:
new Initialize a basic .NET project
restore Restore dependencies specified in the .NET project
build Builds a .NET project
publish Publishes a .NET project for deployment (including the runtime)
run Compiles and immediately executes a .NET project
test Runs unit tests using the test runner specified in the project
pack Creates a NuGet package

posted @ 2016-09-06 20:28  Whikiey  阅读(293)  评论(0编辑  收藏  举报