launch.json中不允许使用属性env [VSCode] [英] Property env is not allowed in launch.json [VSCode]
问题描述
我所要做的就是在VS中初始化一个模板Azure Functions项目,当我尝试通过 launch.json
设置运行配置环境变量时,VS直接警告我这不是允许的".
All I've done is initialize a template Azure Functions project in VS and when I try to set run configuration environment variables via launch.json
, VS directly warns me that it's not "allowed".
此外,即使我尝试使用env运行 .ps1
,它也不起作用,因为我有类似的东西
Furthermore, even when I try to run my .ps1
with env anyway, it doesn't work because I have something like
$variable = $env:AWS_REGION
Write-Host $variable
并且终端输出为空白,因此很显然它不起作用.
and the terminal output is blank, so clearly it's not working.
推荐答案
It's not possible directly atm see Issue 1472
但是我可以看到您正在尝试启动本地版本的azure函数,因此您可以在local.settings.json或profile.ps1中声明环境变量这仅表示在运行z函数的本地实例时可用,而在集成的Powershell控制台中不可用.local.settings.json也是azure中应用程序配置的本地版本,如果您使用的是git,则应确保将此文件包含在gitignore中.
I can however see that you are trying to start local version of azure functions, so you could declare your environment variables in local.settings.json or in profile.ps1 This just means its avalible while running the local instance of az functions, and not avalible in the integrated powershell console. the local.settings.json is also the local version of app configuration in azure and you should makre sure to include this file in your gitignore, if you are using git.
这篇关于launch.json中不允许使用属性env [VSCode]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!