Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Bicep module fails if the dotnetAcquisitionExtension.sharedExistingDotnetPath is set to a Windows path in WSL. #15098

Closed
dozer75 opened this issue Sep 17, 2024 · 3 comments

Comments

@dozer75
Copy link

dozer75 commented Sep 17, 2024

Does this occur consistently? Yes
Repro steps:

  1. Have a Windows environment with WSL
  2. In the Visual Studio Code settings, set the dotnetAcquisitionExtension.sharedExistingDotnetPath to the Windows path to the dotnet executable.
  3. In WSL, open a Bicep folder in Visual Studio Code (with Bicep extension enabled for WSL) and the message below will be displayed.

The reason for using dotnetAcquisitionExtension.sharedExistingDotnetPath is that this is a restricted environment where the .NET install tool is refused to be executed since there are restricted policy for PowerShell execution, and using this setting is the only way around, so it is not an option removing it.

Action: bicep.activate
Error type: Error
Error Message: Failed to find dotnet executable at path '/mnt/c/Users/USER/AppData/Local/Programs/Microsoft VS Code/C:\Program Files\dotnet\dotnet.exe'.

Version: 0.29.47
OS: linux
OS Release: 5.15.153.1-microsoft-standard-WSL2
Product: Visual Studio Code
Product Version: 1.93.1
Language: en

Call Stack
ensureDotnetRuntimeInstalled extension.js:2:2478045
extension.js:2:2810095extension.js:2:2810095
@anthony-c-martin
Copy link
Member

anthony-c-martin commented Sep 17, 2024

@dozer75 I believe that in WSL, the dotnet command is going to be executed inside a virtualized Linux environment. I suspect you'd need to install the dotnet SDK inside WSL, and then use the Linux path to the SDK. C:\Program Files\dotnet\dotnet.exe is a Windows executable, and I wouldn't expect it to run on Linux.

This isn't something I've tried - not sure if anyone in the community has an example of how to achieve this. If you get it working, please share your steps!

@dozer75
Copy link
Author

dozer75 commented Sep 17, 2024

@anthony-c-martin You are right (and I have installed the SDK on WSL already), however the issue is that the path that I have configured in VS Code for Windows is used by the Bicep extension in WSL, which shouldn't be used. Removing the setting will cause the Windows environment to break so that's not an option.

@anthony-c-martin
Copy link
Member

Gotcha. In that case, I think it makes sense to track this under the issue dotnet/vscode-dotnet-runtime#1952 you've just created. I'll close this one.

@github-project-automation github-project-automation bot moved this from Todo to Done in Bicep Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants