由于我的开发环境比较复杂,每次调试一套项目都要启动好几个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:
Selecting this option will open the System Properties dialog:
Click Environment Variables to view the list of current environment variables on your system.
Assuming you do not already have a variable called ASPNETCORE_ENVIRONMENT
, click the New... button and add a new account 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.