要运行标准命令行,请使用: set ASPNET_ENV=Developmentdnx web 对于Powershell,请使用: $env:ASPNET_ENV='Development'dnx web 更短版本: dnx web ASPNET_ENV=Development I am developing an ASP.NET 5 Web API app using Visual Studio code on Mac. I manually modified my Properties/launchSettings.json file to set environment to Staging for all profiles using ASPNET_ENV environment variable: However, when I run dnx web in Mac terminal to start the app, I still get Production environment:Can I use launchSettings.json to specify environment variables (and, thus, environment types) if I use Visual Studio Code on Mac? Or is it specific to full Visual Studio?ASP.NET 5 docs suggest that launchSettings.json can be used to inject environment variables. However, this SO discussion suggests passing them through commands. 解决方案 LaunchSettings.json is strictly a VS concept. In other cases, you will have to configure environment variables as commands below:For standard command line run, use:set ASPNET_ENV=Developmentdnx webFor powershell, use:$env:ASPNET_ENV='Development'dnx webShorter version: dnx web ASPNET_ENV=Development 这篇关于从Mac上的命令行运行ASP.NET 5应用程序时是否使用launchSettings.json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 07:23