Open m-bennett opened 1 year ago
Seeing the same problem
Same here on Windows 11.
I have a similar installation problem on Windows 10. The action of downloading .Net Runtime 7.0.9 ends with the error (see below, with personal info removed). Each time extension attempts to load the DotNet Runtime, the different file is listed as locked.
Command failed: powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; & '%HOMEPATH%\.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-1.6.0\dist\install scripts\dotnet-install.ps1' -InstallDir '%HOMEPATH%\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\7.0.9' -Version 7.0.9 -Runtime dotnet }
dotnet-install: Failed to extract package. Exception: Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file '%HOMEPATH%\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\7.0.9\shared\Microsoft.NETCore.App\7.0.9\clrgc.dll' because it is being used by another process."
Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file %HOMEPATH%\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\7.0.9\shared\Microsoft.NETCore.App\7.0.9\clrgc.dll' because it is being used by another process."
At %HOMEPATH%\.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-1.6.0\dist\install scripts\dotnet-install.ps1:834 char:21
+ ... [System.IO.Compression.ZipFileExtensions]::ExtractToFile( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : IOException
I'm not sure why this command is failing. Searching using Process Explorer did not yield any results, and running the mentioned command (see sanitized version below with the closing double quote added) directly from CMD/Powershell returns dotnet-install: .NET Core Runtime with version '7.0.9' is already installed.
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; & %HOMEPATH%\.vscode\extensions\ms-dotnettools.vscode-dotnet-runtime-1.6.0\dist\install scripts\dotnet-install.ps1' -InstallDir '%HOMEPATH%\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\7.0.9' -Version 7.0.9 -Runtime dotnet }"
While we're triaging this issue, you can try telling the extension where an existing .NET installation is, so that it doesn't keep downloading a new one (which is a bug I think we've already addressed elsewhere): https://github.com/dotnet/vscode-dotnet-runtime/blob/main/Documentation/troubleshooting-runtime.md#manually-installing-net
It does not work for me even after adding the settings in user settings.json:
{
"security.workspace.trust.untrustedFiles": "open",
"editor.fontSize": 16,
"files.trimTrailingWhitespace": true,
"terminal.integrated.enablePersistentSessions": false,
"dotnetAcquisitionExtension.existingDotnetPath": [
{
"extensionId": "msazurermtools.azurerm-vscode-tools",
"path": "C:\\Program Files\\dotnet\\dotnet.exe"
}],
}
I was able to resolve the issue by installing an older version of the C# extension. I had version 2.0.328 installed when I was experiencing the issue, then I rolled back to version 1.26.0 (it's about 1 month old). Now it's working.
@neolib when you say "It does not work for me even after adding the settings in user settings.json", what output/etc are you seeing that makes you believe that is the case?
The key problem is that it tries to download latest .NET runtime even I have already installed it.
Downloading the .NET Runtime.
Downloading .NET version(s) 7.0.10 ......................................................................................................................... Error!
Failed to download .NET 7.0.10:
.NET installation timed out.
Error!
.NET Acquisition Failed: Installation failed: Error: .NET installation timed out.
Reaching the same problem.
I found a solution, self-test available. In the VS Code setting.json configuration file, add the following configuration:
"dotnetAcquisitionExtension.existingDotnetPath": [
{"extensionId": "msazurermtools.azurerm-vscode-tools", "path": "/usr/local/share/dotnet/dotnet"},
{
"extensionId": "ms-dotnettools.csdevkit",
"path": "/usr/local/share/dotnet/dotnet"
},
{
"extensionId": "ms-dotnettools.vscodeintellicode-csharp",
"path": "/usr/local/share/dotnet/dotnet"
},
{
"extensionId": "ms-dotnettools.csharp",
"path": "/usr/local/share/dotnet/dotnet"
},
{
"extensionId": "ms-dotnettools.vscode-dotnet-runtime",
"path": "/usr/local/share/dotnet/dotnet"
}
]
Repro steps:
dotnet --list-runtimes Microsoft.AspNetCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
dotnet --list-sdks 7.0.109 [/usr/lib/dotnet/sdk]
The problem started occurring just after updating my software, including VS Code and a bunch of other stuff.
Open a .NET project, and I see a message saying that it is downloading .NET version 7.0.9, then fails after about 10 seconds with the following error.
Extension Version: 1.0.0 Error Message: .NET Acquisition Failed: Installation failed: Error: Command failed: "/home/anonymous/.vscode/extensions/ms-dotnettools.vscode-dotnet-runtime-1.6.0/dist/install scripts/dotnet-install.sh" -InstallDir "/home/anonymous/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9" -Version 7.0.9 -Runtime dotnet
gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now dotnet_install: Error: Extraction failed
Error Stack: Error: .NET Acquisition Failed: Installation failed: Error: Command failed: "/home/anonymous/.vscode/extensions/ms-dotnettools.vscode-dotnet-runtime-1.6.0/dist/install scripts/dotnet-install.sh" -InstallDir "/home/anonymous/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9" -Version 7.0.9 -Runtime dotnet
gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now dotnet_install: Error: Extraction failed