-
Notifications
You must be signed in to change notification settings - Fork 13
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
[BUG] Projects failed to load after installing c# Dev Kit #367
Comments
Hi! Based on your error, it looks like VS Code is trying to open a solution containing old csproj files that are not supported by the C# Dev Kit. You can verify it by opening a .csproj, if they start with: <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> Then that's what is causing the issue.
The <Project ToolsVersion="Current" Sdk="Microsoft.NET.Sdk"> And the C# Dev Kit should now be able to open the solution. |
Hi, @jbevain, I followed all the steps you mention, and after this I made sure the header of my csproj files is this:
Unfortunately the problem persists in my computer. However that fix worked for one of my colleagues. |
In my case I am using .NET 7
|
Thanks for reporting this. You're the second one on macOS 10.15/x64 reporting a similar issue, we're trying to see if we can reproduce it. |
FYI.. my issue is on Windows 11. |
@jbevain would be nice if we could force logger to log everything (trace level or something), but all the logs we get are literally |
I have this issue. I looked into the extension logs and found this. [exthost/ms-dotnettools.csdevkit/ServiceHub/FA474B2D-Microsoft.VisualStudio.ProjectSystem.CompositionService-9528-gwcjacua-1.log] 08/10/2023 10:03:58 Greenwich Mean Time: Error : 9528 :!!Resolve NET Core SDK: Failed Which in turn relates to this issue in the MSBuildLocator |
The same issue. Also mac 13.4.1 |
I fixed it by add configuration to setting.json
|
Hi @yuhuihu I tried to add your snippet of code to my settings.json and restart VS, but didnt fix the problem in my case :( In case it helps, this is my entire settings.json content:
|
i have this problem in windows 11(( |
also this problem is observed in all my colleagues, with windows version 10/11 |
In my case, I found a reason with the .net SDK version. Also try to set
https://learn.microsoft.com/en-us/dotnet/core/install/macos I'm really glad it finally start to work....! |
I partially solved the issue by reinstalling the C# Devkit. All projects are loading but no code navigation works (F12). That's a biggy for me. Just as a test I loaded the solution up in Visual studio 2022. Works there but not in vscode. Been long enough with MS vscode tools to tell you this is a trend. Almost feels intentional. |
Also seeing this problem on Mac Big Sur |
Also seeing this problem. Running VS Code on an Intel Core i7 MacBook with MacOS 11.3.
This is the log:
|
@symbion6 When you run into this problem, would you be able to run "Developer: Open Extension Logs Folder" from the command palette, and then zip up and share the "ms-dotnettools.csdevkit" folder? I suspect an error message about this issue may be buried there. |
ms-dotnettools.csdevkit.zip |
Thanks @firekim2, unfortunately it didnt work. I updated to 7.0.400 (and removed the older version) and added the global.json file, but I keep getting the same error.
|
Having the same issue with Unity 2018.4.16.
I looked into vs code log folder, and found this: 08/18/2023 15:00:31 中国标准时间: Information : 24116 :SDK folder is resolved to 'C:\Program Files\dotnet\sdk\7.0.306' based on path 'c:\Users\xxx. |
@YoungXiang I believe that is a different problem; can you please open a new issue so we can track it properly? |
@SimeonIksanov Thank you for the logs; you are indeed seeing the same issue as @tmitchel2. |
For those of you experiencing this issue (specifically, the one where hostfxr is not being found) we are actively working on it. The failure is occurring in a code path that attempts to detect the available .NET SDKs; it is challenging to get this to work correctly across all relevant architectures, operating systems, and install methods. |
On Mac this will fix the 'xx project failed to load' (adjust version as necessary)... until the ext is fixed Copy this file: To: (which is where the extension is looking, thanks to @tmitchel2 for pointing out the log location.) |
Same issue. mgmhunt's temp fix (comment above) doesn't work for me. I don't have the ...Microsoft.NetCore.App/ folder... Output as follows: 2023-08-27 23:11:32.380 [info] Additional information of .NET SDKs for diagnostic.NET SDK: Runtime Environment: Host: .NET SDKs installed: .NET runtimes installed: Other architectures found: Environment variables: global.json file: Learn more: Download .NET: 2023-08-27 23:11:32.385 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load. |
[/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.10 jonnymarkd Have you tried right-clicking on the Microsoft.NETCore.App and choosing Show Package Contents? should take you to folder structure |
Thanks @mgmhunt - Did the trick for me. Now for the ext fix... |
I tried this. I keep receiveing the same "0 projects loaded 45 failed to load". But now I receive some extra errors I have never seen before. I get one of this for each project:
|
@chemari sounds like progress actually :) ie generating errors vs not loading at all. Maybe regen the csproj files via Unity Preferences -> External Tools. I'm running the exact setup as you in the original comment. |
The issue was addressed in the scope of dotnet/msbuild#9038 You can use the package with the fix https://www.nuget.org/packages/Microsoft.Build.Locator/1.6.1. |
I had the same issue on macOS Big Sur. I updated OS to Monterey and it works now. |
there are multiple different issues in this thread: 2, traditional unity projects, (or other traditional mono projects or Framework projects on windows) those are currently not supported by C# Dev Kit, but some pending fix in this area would allow language experience to work. It is still on-going work. 3, extension was broken when NET 8 preview 7 was out. it was a gap between multiple product line due to the extension runs on NET 7 runtime loads build related assemblies from SDK, which were updated to build on NET 8 runtime. During initialization, this corrupted a cache file, which lead it tricky to apply a workaround (that is why some people might not get it to work with a global.json file, but some might not be able to) This issue should have been addressed with a later update. |
This post from Unity solved my issues:
|
It worked for me. Thank's a lot! |
Hi, At this point we believe the
Because this issue evolved with multiple different issues, if you hit more loading issues please open a new one. Thank you! |
Hi. |
This kind of similar fix for me. but my place need to change was in |
Describe the Issue
After installing C# Dev Kit in my Mac, and opening an Unity project, I receive this error in the console
"Project system initialization finished. 0 project(s) are loaded, and 49 failed to load."
There are no error descriptions in the console or any clue that could lead me to a solution, so couldnt get any info why this is happening. But since then I cannot navigate through "Go to definition", "Go to references", etc. The red underline compilation errors also disappeared from the editor!
Steps To Reproduce
Expected Behavior
No response
Environment Information
No response
The text was updated successfully, but these errors were encountered: