Windows 下開發.NET Core應用

1、使用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目錄啦
2、使用命令行方式開發
若是以爲前一種方式不爽,不想安裝那麼大的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)ui

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 packagerest

相關文章
相關標籤/搜索