Open sirdawidd opened 1 year ago
After some investigation, it work when I removed from user variables DOTNET_ROOT. However the path was correctly setup, and even error mentioned that I need to define base directory.... Now I only have issues, that some plugins in VS code, does not work, as they cant find installation of .net ....
I ve got the same problem for some time now.
I m using 6.0.406-win-x64 zip version. I ve setup
DOTNET_ROOT = path/to/sdk-6.0.406-win-x64
and added %DOTNET_ROOT% to Path
It s only the test debugging
that s not working.
That s my setup on other machines as well and it s working properly.
I'm seeing the same problem for both "Run Test" and "Debug Test". I have dotnet 7.0.400 extracted to c:\users\x\AppData\Local\dotnet. DOTNET_ROOT is set and added to PATH. Running dotnet test
in the vscode terminal works fine.
After playing with this a bit I think I've found a workaround. Setting the environment variable VSTEST_WINAPPHOST_DOTNET_ROOT
to my dotnet location fixes it for me.
Environment data
.NET SDK (reflecting any global.json): Version: 6.0.403
Commit: 2bc18bf292
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042 OS Platform: Windows
RID: win10-x64 Base Path: C:\Programs\dotnet-sdk-6.0.403-win-x64\sdk\6.0.403\
global.json file: Not found
Host: Version: 6.0.11 Architecture: x64 Commit: 943474ca16
.NET SDKs installed: 6.0.403 [C:\Programs\dotnet-sdk-6.0.403-win-x64\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.11 [C:\Programs\dotnet-sdk-6.0.403-win-x64\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.11 [C:\Programs\dotnet-sdk-6.0.403-win-x64\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.11 [C:\Programs\dotnet-sdk-6.0.403-win-x64\shared\Microsoft.WindowsDesktop.App]
Download .NET: https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs: https://aka.ms/dotnet/runtimes-sdk-info VS Code version: C# Extension version:
OmniSharp log
OmniSharp server started with .NET 6.0.403 . Path: c:\Users\xxx.vscode\extensions\ms-dotnettools.csharp-1.25.2-win32-x64.omnisharp\1.39.2-net6.0\OmniSharp.dll PID: 24196
When I try to debug test I see
Steps to reproduce
Failed to read environment variable [DOTNET_ROOT], HRESULT: 0x80070002 A fatal error occurred. The required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [c:\Users\Api.Tests\bin\Debug\net6.0]. If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].
The .NET Core runtime can be found at:
Option Run Test, works fine , I get test results, also debugging is working, if I run it manually: Create test process and attach debugger. Also o .net 5 I didn't faced similar issue.
Expected behavior
Click Debug Test option in Vs Code should run debugger without error.
Actual behavior
Failed to read environment variable [DOTNET_ROOT], HRESULT: 0x80070002 A fatal error occurred. The required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [c:\Users\Tests\bin\Debug\net6.0]. If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].
The .NET Core runtime can be found at: