Closed dcporter65 closed 5 months ago
I had something similar in Visual studio 2022 v17.8.3 After rolling back to 17.6.4 I still couldn't it working (was getting a slightly different error). I repaired 17.6.4 install, then updated to 17.8 again and that seems to have resolved the problem 🤞
In my case, clicking "Restart to Update" visual studio code on m1 mac got it working again for me.
UPDATE: pre release Version 1.4.28 fixed the issue .
Same here. But System.Runtime 8.0.0 is not found instead of Microsoft.DotNet.Cli.Utils.
Vs code 1.87
(everything runs fine in vs 2022 community)
This issue has been marked as stale after 14 days of inactivity. @[ @ @], could you please take a look?
This is still an issue for me with C# Dev Kit v1.4.29
SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.Sdk". Exception: "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.Cli.Utils, Version=7.0.407.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.DotNet.Cli.Utils, Version=7.0.407.0,
As before, removing C# Dev Kit fixes the SDK Resolver error.
I did notice that the version number shown in the error has an extra ".0" after it - 7.0.407.0
. The path to my SDK is simply this: C:\Program Files\dotnet\sdk\7.0.407
@lifengl can you see if the version number is an issue that's still causing a problem?
@dcporter65 :
can you print out dotnet --info (make sure run it in the root folder of your workspace)? This might help us to know the version matrix when this problem happens.
On the other side, I guess this might be a gap because the CDK uses a private copy of msbuild to support older SDKs, due to a version mismatching issue. It was a problem on NET 7 and older SDKs. It might lead it to fail on a newer version of NET 7 SDK (7.0.407 was released later than the CDK build of msbuild.) This private copy is a workaround, and should be phased out when the older version of SDK is no longer supported. For NET 7 SDK, it ends on May 14, 2024.
@dcporter65 : I will suggest to update to NET 8 SDK and current version of the CDK to see whether it resolves your problem.
@lifengl
can you print out dotnet --info (make sure run it in the root folder of your workspace)? This might help us to know the version matrix when this problem happens.
.NET SDK: Version: 7.0.408 Commit: 03a0111c2e Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.408\ Host: Version: 7.0.18 Architecture: x64 Commit: 544c7e6eb3 .NET SDKs installed: 6.0.421 [C:\Program Files\dotnet\sdk] 7.0.408 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Update:
I have upgraded the .NET SDK to 8.0 and projects are loading successfully.
I'm having the same issue in .net 8.0.
Describe the Issue
Loading an existing C# project in VS Code with the C# Dev Kit installed on Windows throws an SDK Resolver failure error and the project fails to load. As a result, tests and IntelliSense are unavailable in the project.
Removing the C# Dev Kit extension fixes the issue.
Steps To Reproduce
csharp
folder.Result
The project fails to load and SDK Resolver failure errors appear in the Projects log. This happens multiple times when loading a solution with multiple projects.
Projects log output
2024-03-11 09:19:10.883 [error] (C:\Users\david.porter\Dev\samples\csharp\getting-started\console-webapiclient\webapiclient.csproj): SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.Sdk". Exception: "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.Cli.Utils, Version=7.0.406.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.DotNet.Cli.Utils, Version=7.0.406.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.GetSdkDirectory(SdkResolverContext context) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.GetDotNetRoot(SdkResolverContext context) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext resolverContext, SdkResultFactory factory) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.TryResolveSdkUsingSpecifiedResolvers(IList`1 resolvers, Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio, SdkResult& sdkResult, IEnumerable`1& errors, IEnumerable`1& warnings)"" 2024-03-11 09:19:10.979 [error] Failed to load project 'C:\Users\david.porter\Dev\samples\csharp\getting-started\console-webapiclient\webapiclient.csproj'. One or more errors occurred. (SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.Sdk". Exception: "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.Cli.Utils, Version=7.0.406.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.DotNet.Cli.Utils, Version=7.0.406.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.GetSdkDirectory(SdkResolverContext context) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.GetDotNetRoot(SdkResolverContext context) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext resolverContext, SdkResultFactory factory) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.TryResolveSdkUsingSpecifiedResolvers(IList`1 resolvers, Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio, SdkResult& sdkResult, IEnumerable`1& errors, IEnumerable`1& warnings)"" C:\Users\david.porter\Dev\samples\csharp\getting-started\console-webapiclient\webapiclient.csproj) 2024-03-11 09:19:10.987 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load.Expected Behavior
The project should open without any failures.
Workaround
Result
The project loads successfully without errors.
Environment Information
VSCode version: 1.87.1 C# extension: 2.8.23 C# Dev Kit extension: 1.3.10 Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 7.0.406 Commit: cf888f0acf Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.406\ Host: Version: 7.0.16 Architecture: x64 Commit: 567edafe61 .NET SDKs installed: 6.0.419 [C:\Program Files\dotnet\sdk] 7.0.406 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/downloadVisual Studio Code Extensions
42crunch.vscode-openapi@4.25.1 alexkrechik.cucumberautocomplete@2.15.2 amillard98.specflow-tools@1.1.3 bierner.markdown-mermaid@1.22.0 blackmist.linkcheckmd@0.3.1 blodwynn.featurehighlight@1.8.0 bpruitt-goddard.mermaid-markdown-syntax-highlighting@1.6.0 christian-kohler.npm-intellisense@1.4.5 clemenspeters.format-json@1.0.3 davidanson.vscode-markdownlint@0.54.0 davidnussio.vscode-jq-playground@4.3.5 docsmsft.docs-article-templates@1.0.3 docsmsft.docs-authoring-pack@1.0.1 docsmsft.docs-build@0.4.2 docsmsft.docs-images@1.0.1 docsmsft.docs-linting@0.0.13 docsmsft.docs-markdown@1.0.7 docsmsft.docs-metadata@1.0.9 docsmsft.docs-preview@1.0.5 docsmsft.docs-scaffolding@1.0.4 docsmsft.docs-yaml@1.0.1 donjayamanne.githistory@0.6.20 editorconfig.editorconfig@0.16.4 formulahendry.dotnet-test-explorer@0.7.8 formulahendry.vscode-mysql@0.5.0 foxundermoon.shell-format@7.2.5 github.vscode-pull-request-github@0.82.0 heaths.vscode-guid@1.9.0 humao.rest-client@0.25.1 jebbs.plantuml@2.17.5 jmrog.vscode-nuget-package-manager@1.1.6 jq-syntax-highlighting.jq-syntax-highlighting@0.0.2 k--kato.docomment@1.0.0 learningengineeringoperations.learn-training-ai-assistant@1.0.36 ms-azuretools.vscode-docker@1.29.0 ms-dotnettools.csdevkit@1.3.10 ms-dotnettools.csharp@2.18.16 ms-dotnettools.vscode-dotnet-runtime@2.0.2 ms-dotnettools.vscodeintellicode-csharp@0.1.26 ms-python.black-formatter@2024.0.1 ms-python.debugpy@2024.2.0 ms-python.python@2024.2.1 ms-python.vscode-pylance@2024.2.3 ms-toolsai.jupyter@2024.2.0 ms-toolsai.jupyter-keymap@1.1.2 ms-toolsai.jupyter-renderers@1.0.17 ms-toolsai.vscode-jupyter-cell-tags@0.1.8 ms-toolsai.vscode-jupyter-slideshow@0.1.5 ms-vscode-remote.remote-containers@0.348.0 ms-vscode-remote.remote-wsl@0.86.0 ms-vscode-remote.vscode-remote-extensionpack@0.25.0 ms-vscode.remote-server@1.5.1 msjsdiag.vscode-react-native@1.12.3 redhat.vscode-yaml@1.14.0 stoplight.spectral@1.1.2 streetsidesoftware.code-spell-checker@3.0.1 unifiedjs.vscode-mdx@1.8.1 waderyan.gitblame@10.9.0 yy0931.gitconfig-lsp@0.10.1