dotnet / vscode-dotnet-runtime

VSCode Extension for Installing .NET via VS Code
MIT License
130 stars 236 forks source link

Failed to install .NET runtime v8.0 in Windows for bicep extensions #1666

Open Johjan58 opened 5 months ago

Johjan58 commented 5 months ago

Describe the bug.

Failed to install .NET runtime v8.0 in Windows for bicep extensions

I'm getting this error: s-azuretools.vscode-bicep requested to download the .NET Runtime. Downloading .NET version(s) 8.0.2~x64 ...... Error! Failed to download .NET 8.0.2~x64: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

Error! Failed to download .NET 8.0.2~x64: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

Error! Failed to download .NET 8.0: .NET Acquisition Failed: Installation failed: Error: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

execution policy for user is set to: Get-ExecutionPolicy RemoteSigned

image

When I tried to add the following manually in the .net settings, the vscode is stuck at acquiring dotnetruntime. { "workbench.settings.applyToAllProfiles": [], "dotnetAcquisitionExtension.existingDotnetPath": [ { "extensionId": "ms-azuretools.vscode-bicep", "path": "C:\Program Files\dotnet\dotnet.exe" } ] }

![Uploading image.png…]()

Please attach log file(s) here if you have any.

ms-azuretools.vscode-bicep requested to download the .NET Runtime. Downloading .NET version(s) 8.0.2~x64 ...... Error! Failed to download .NET 8.0.2~x64: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

Error! Failed to download .NET 8.0.2~x64: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

Error! Failed to download .NET 8.0: .NET Acquisition Failed: Installation failed: Error: Your machine policy disables PowerShell language features that may be needed to install .NET. Read more at: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-7.3. If you cannot safely and confidently change the execution policy, try setting a custom existingDotnetPath following our instructions here: https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md.

Reproduction Steps

Download bicep extension and try creating a bicep file. This would load the .netruntime

Expected Behavior

.netruntime should run

Exceptions & Errors (if any)

No response

.NET Install Tool Version

v2.0.1

Your operating system? Please provide more detail, such as the version and or distro above.

Windows

VS Code Version

1.86.1

nagilson commented 4 months ago

What is the output of running this in powerhsell: $ExecutionContext.SessionState.LanguageMode? Are you able to set it to FullLanguage instead so it can run?

Also, do you have a separate log for the failure where it has the setting to use an existingPath but does not work, that way we can investigate that?

MichaelHarmsen commented 2 months ago

We see a somewhat similar behavior on two installations: they try to download .NET 8.0.4 (which is already installed) but never fail or complete.

Output in VSCode: ms-azuretools.vscode-bicep requested to download the .NET Runtime. Downloading .NET version(s) 8.0.4~x64 .......................................................................

The above can keep adding dots for hours.

$ExecutionContext.SessionState.LanguageMode responds with FullLanguage.