ASP.NET CORE dotnet run 命令使用debug方式執行

FreePress發表於2016-10-23

由於我的開發環境比較複雜,每次除錯一套專案都要啟動好幾個VS,比較繁瑣,今天決定換一種方式除錯,對於不該改動的程式碼的附加專案直接使用dotnet run命令以debug的執行方式執行,

一開始無法執行dubug方式,我需要的是Hosting environment: Development模式,後來在谷歌搜尋找到了答案,不得不說百度真的很難找到解決方法,基本都是CTRL+C ,CTRL+V.

方法也很簡單,windows 環境變數裡面新增name= ASPNETCORE_ENVIRONMENT value=Development 的環境變數即可。

Using the windows control panel

If you're not a fan of the command prompt, you can easily update your variables using your mouse!Click the windows start menu button (or press the Windows key), search for environment variables, and choose Edit environment variables for your account:

Searching for control panel in start menu

Selecting this option will open the System Properties dialog:

System properties dialog

Click Environment Variables to view the list of current environment variables on your system.

Environment variables window

Assuming you do not already have a variable called ASPNETCORE_ENVIRONMENT, click the New... button and add a new account environment variable:

Adding a new environment variable

Click OK to save all your changes. You will need to re-open any command windows to ensure the new environment variables are loaded.

相關文章