爲了趕時髦,體驗下.net core,特在Linux下部署個開發環境linux
安裝VSCode工具(Visual Studio Code)centos
#添加源 sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' #安裝,visual studio code的名字就叫code sudo apt-get update sudo apt-get install code
安裝dotnet SDK,點https://aka.ms/dotnet-sdk-2.0.0-linux-x64,下載到HOME下,解壓至DotNet目錄下,設置PATH變量。參考:https://www.microsoft.com/net/core#linuxcentosapp
mkdir ~/dotnet tar zxf dotnet-sdk-2.0.0-linux-x64.tar.gz -C ~/dotnet export PATH=$PATH:$HOME/dotnet
#檢測dotnet sdk是否安裝成功,會出來一段歡迎文字,沒仔細看,過會建立成功了。
dotnet new console -o hwapp
#運行一下Hello World
cd hwapp
dotnet run
在VSCode中調試,打開VSCode,經過菜單欄打開文件夾,選擇hwapp,會自動安裝Ominisharp和.Net Core Debugger。完成後就能設置斷點調試了。工具