I have been unable to find any mechanism to provide these environment variables to Omnisharp so I get proper intellisense.
Since Omnisharp does not have these variables I get error messages in the omnisharp log, eg
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/tasks/CsTask.targets" was not found
When I build from command line I have the environment variable configured and can build correctly. As well as it is possible to provide environment variables for .vscode/tasks.json and .vscode/launch.json when running debug/build commands.
I see omnisharp has support for .env file, could this not also be used for general omnisharp loading and intellisense?
Or is there some other mechanism available? I know I can launch VS Code from a terminal with the environment configured, but I would rather be able to launch it "normally" and have some kind of local configuration with these variables that Omnisharp can consume.
Environment information
VSCode version: 1.49.0
C# Extension: 1.23.2
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.402
Commit: 9b5de826fd
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.402/
Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd
.NET Core SDKs installed:
3.1.402 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|auto-close-tag|formulahendry|0.5.8|
|auto-comment-blocks|kevinkyang|1.0.1|
|auto-rename-tag|formulahendry|0.1.4|
|auto-using|Fudge|0.7.15|
|better-toml|bungcip|0.3.2|
|blazorsnippets|ScottSauber|1.3.0|
|bracket-pair-colorizer-2|CoenraadS|0.2.0|
|brick|koliyo|0.1.0|
|camelcasenavigation|maptz|1.1.3|
|change-case|wmaurer|1.0.0|
|cmake|twxs|0.0.17|
|cmake-tools|ms-vscode|1.4.1|
|code-settings-sync|Shan|3.4.3|
|cpptools|ms-vscode|0.30.0-insiders5|
|csharp|ms-dotnettools|1.23.2|
|debugger-for-chrome|msjsdiag|4.12.10|
|dhall-lang|panaeon|0.0.4|
|dotenv|mikestead|1.0.1|
|ginfuru-vscode-jekyll-syntax|ginfuru|0.1.1|
|gitlens|eamodio|10.2.2|
|go|golang|0.16.2|
|gradle-language|naco-siren|0.2.3|
|hjson|laktak|0.3.2|
|insert-unicode|brunnerh|0.8.0|
|jinjahtml|samuelcolvin|0.15.0|
|jsonnet|heptio|0.1.0|
|jumpprotobuf|ldcf4|0.0.3|
|kotlin|fwcd|0.2.18|
|language-julia|julialang|1.0.7|
|language-prometheus|caarlos0|0.1.2|
|language-stylus|sysoev|1.11.0|
|lit-html|bierner|1.11.1|
|lsp-inspector-webview|octref|0.0.2|
|markdown-all-in-one|yzhang|3.3.0|
|material-theme|zhuangtongfa|3.8.7|
|mono-debug|ms-vscode|0.15.8|
|npm-intellisense|christian-kohler|1.3.1|
|prettify-json|mohsen1|0.0.3|
|project-manager|alefragnani|11.3.0|
|python|ms-python|2020.8.108011|
|QML|bbenoist|1.0.0|
|remote-ssh|ms-vscode-remote|0.55.0|
|remote-ssh-edit|ms-vscode-remote|0.55.0|
|restructuredtext|lextudio|129.0.0|
|rust|rust-lang|0.7.8|
|scriban|xoofx|1.1.0|
|shader|slevesque|1.1.4|
|swig-tpl|zhangciwu|0.0.6|
|terraform|hashicorp|2.2.3|
|vetur|octref|0.27.3|
|vscode-docker|ms-azuretools|1.5.0|
|vscode-eslint|dbaeumer|2.1.8|
|vscode-fileutils|sleistner|3.0.1|
|vscode-graphql|Prisma|0.3.2|
|vscode-icons|vscode-icons-team|10.2.0|
|vscode-jekyll-snippets|ginfuru|0.9.3|
|vscode-jest|Orta|3.2.0|
|vscode-journal|pajoma|0.10.0|
|vscode-markdownlint|DavidAnson|0.36.3|
|vscode-new-file|dkundel|4.0.2|
|vscode-nginx|shanoor|0.6.0|
|vscode-npm-script|eg2|0.3.13|
|vscode-nuget-package-manager|jmrog|1.1.6|
|vscode-open-in-github|ziyasal|1.3.6|
|vscode-open-in-sublime-merge|morrislaptop|0.6.0|
|vscode-paste-and-indent|Rubymaniac|0.0.8|
|vscode-proto3|zxh404|0.4.2|
|vscode-test-explorer|hbenl|2.19.1|
|vscode-theme-onedark|akamud|2.2.2|
|vscode-typescript-tslint-plugin|ms-vscode|1.2.3|
|vscode-yaml|redhat|0.10.1|
|vscode-yarn|gamunu|1.7.1|
|vscodeintellicode|VisualStudioExptTeam|1.2.10|
|vsliveshare|ms-vsliveshare|1.0.2740|
|vsnotes|patricklee|0.7.1|
|vue-snippets|hollowtree|0.1.12|;
Issue Description
Unable to find mechanism for providing environment variables to Omnisharp for intellisense.
My
.csproj
files sometimes contain paths to local projects, using environment variables. EgI have been unable to find any mechanism to provide these environment variables to Omnisharp so I get proper intellisense.
Since Omnisharp does not have these variables I get error messages in the omnisharp log, eg
When I build from command line I have the environment variable configured and can build correctly. As well as it is possible to provide environment variables for
.vscode/tasks.json
and.vscode/launch.json
when running debug/build commands.I see omnisharp has support for
.env
file, could this not also be used for general omnisharp loading and intellisense?Or is there some other mechanism available? I know I can launch VS Code from a terminal with the environment configured, but I would rather be able to launch it "normally" and have some kind of local configuration with these variables that Omnisharp can consume.
Environment information
VSCode version: 1.49.0 C# Extension: 1.23.2
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.402 Commit: 9b5de826fd Runtime Environment: OS Name: Mac OS X OS Version: 10.14 OS Platform: Darwin RID: osx.10.14-x64 Base Path: /usr/local/share/dotnet/sdk/3.1.402/ Host (useful for support): Version: 3.1.8 Commit: 9c1330dedd .NET Core SDKs installed: 3.1.402 [/usr/local/share/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |auto-close-tag|formulahendry|0.5.8| |auto-comment-blocks|kevinkyang|1.0.1| |auto-rename-tag|formulahendry|0.1.4| |auto-using|Fudge|0.7.15| |better-toml|bungcip|0.3.2| |blazorsnippets|ScottSauber|1.3.0| |bracket-pair-colorizer-2|CoenraadS|0.2.0| |brick|koliyo|0.1.0| |camelcasenavigation|maptz|1.1.3| |change-case|wmaurer|1.0.0| |cmake|twxs|0.0.17| |cmake-tools|ms-vscode|1.4.1| |code-settings-sync|Shan|3.4.3| |cpptools|ms-vscode|0.30.0-insiders5| |csharp|ms-dotnettools|1.23.2| |debugger-for-chrome|msjsdiag|4.12.10| |dhall-lang|panaeon|0.0.4| |dotenv|mikestead|1.0.1| |ginfuru-vscode-jekyll-syntax|ginfuru|0.1.1| |gitlens|eamodio|10.2.2| |go|golang|0.16.2| |gradle-language|naco-siren|0.2.3| |hjson|laktak|0.3.2| |insert-unicode|brunnerh|0.8.0| |jinjahtml|samuelcolvin|0.15.0| |jsonnet|heptio|0.1.0| |jumpprotobuf|ldcf4|0.0.3| |kotlin|fwcd|0.2.18| |language-julia|julialang|1.0.7| |language-prometheus|caarlos0|0.1.2| |language-stylus|sysoev|1.11.0| |lit-html|bierner|1.11.1| |lsp-inspector-webview|octref|0.0.2| |markdown-all-in-one|yzhang|3.3.0| |material-theme|zhuangtongfa|3.8.7| |mono-debug|ms-vscode|0.15.8| |npm-intellisense|christian-kohler|1.3.1| |prettify-json|mohsen1|0.0.3| |project-manager|alefragnani|11.3.0| |python|ms-python|2020.8.108011| |QML|bbenoist|1.0.0| |remote-ssh|ms-vscode-remote|0.55.0| |remote-ssh-edit|ms-vscode-remote|0.55.0| |restructuredtext|lextudio|129.0.0| |rust|rust-lang|0.7.8| |scriban|xoofx|1.1.0| |shader|slevesque|1.1.4| |swig-tpl|zhangciwu|0.0.6| |terraform|hashicorp|2.2.3| |vetur|octref|0.27.3| |vscode-docker|ms-azuretools|1.5.0| |vscode-eslint|dbaeumer|2.1.8| |vscode-fileutils|sleistner|3.0.1| |vscode-graphql|Prisma|0.3.2| |vscode-icons|vscode-icons-team|10.2.0| |vscode-jekyll-snippets|ginfuru|0.9.3| |vscode-jest|Orta|3.2.0| |vscode-journal|pajoma|0.10.0| |vscode-markdownlint|DavidAnson|0.36.3| |vscode-new-file|dkundel|4.0.2| |vscode-nginx|shanoor|0.6.0| |vscode-npm-script|eg2|0.3.13| |vscode-nuget-package-manager|jmrog|1.1.6| |vscode-open-in-github|ziyasal|1.3.6| |vscode-open-in-sublime-merge|morrislaptop|0.6.0| |vscode-paste-and-indent|Rubymaniac|0.0.8| |vscode-proto3|zxh404|0.4.2| |vscode-test-explorer|hbenl|2.19.1| |vscode-theme-onedark|akamud|2.2.2| |vscode-typescript-tslint-plugin|ms-vscode|1.2.3| |vscode-yaml|redhat|0.10.1| |vscode-yarn|gamunu|1.7.1| |vscodeintellicode|VisualStudioExptTeam|1.2.10| |vsliveshare|ms-vsliveshare|1.0.2740| |vsnotes|patricklee|0.7.1| |vue-snippets|hollowtree|0.1.12|;