I have set the .NET external editor to Visual Studio. When I open a C# script from Godot, Visual Studio Insiders (version 11716.218) launches and the project is marked as ‘unloaded’. Reloading it triggers an error:
The SDK resolver type "NuGetSdkResolver" failed to load. Could not load file or assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. D:\XXX\XXX.csproj
However, if I open the C# project directly from the .sln file in the folder, it works fine. In this case, double-clicking a .cs script from Godot also opens the same instance of Visual Studio,
but the breakpoints don’t respond at all when I run the game.
EDIT: Nvm that might only be required for actual engine development. Worth a shot though, I could never get VS to work, I recommend either using VS Code (Which, as far as I know, works quite well with the godot extension) or even better, JetBrains Rider.
The error is telling you that it can’t find `System.Runtime`for .Net 10, check the context menu for the project in VS to see if it is actually targeting .Net 8 (been a long time but I think it’s right click project and choose properties, from properties choose the Application Tab).
Alternately one of the nuget packages you pulled down may be compiled specifically for .Net 10, which would force the entire dependency chain to look for Net 10, in which case you may want to install .Net 10, and have your project target it instead.
I use .NET, so it shouldn’t have anything to do with C++, but it still doesn’t work after I installed it. Maybe I’ll give VS Code a try, but I prefer VS — its C# features are still the most intuitive.
The “Application” tab does indeed show .NET 8; in fact, this should correspond to the configuration in the .csproj file.
The versions of the NuGet packages Godot.SourceGenerators, GodotSharp, and GodotSharpEditor are all locked at 4.6.2 and cannot be changed.
The issue is that when I launch VS by opening the .sln file directly from the folder, it loads normally, but only the instance of VS opened by double-clicking a script in Godot has this problem. This indicates that the project itself is fine.
I tried this on another computer and encountered the same issue.
The nuget packages you describe are for interacting with the editor, ie extending the editor using C#, in which case the nuget package version and the godot editor version have to be the same.
A standard c# godot project has no other external dependencies, other than .Net and does not require those packages.
Either way like I said the error is telling you that something is trying to use Net 10, but it is not present on the system, and so the project gets unloaded because the project requirements are not met.
Secondly in your targets you include android which requires version 9 or greater, so maybe that has something to do with why it’s looking for a newer version as this feature requires version 9 or 10.
No sorry, never did a Godot project in VS, and the last version of VS I used was 2022 I think. I switched to Rider and never looked back because I find it much better then VS. And for Godot it does a good job with gd script.
For C# I just use Godot editor to create the project, I then have the Godot editor generate the C# solution, and that’s it.
As I said something in your dependency chain or in Godot’s wants net 10, if you install the net 10 runtime I’m pretty sure that error will go away. For example here’s a screenshot showing a recent project, and you can see even though the target is Net 8 it requires Net 10.
Thanks a lot, you’re right. The preview version installed via Visual Studio Insiders isn’t the same as the stable version, and Godot doesn’t recognize it at all. I downloaded the .NET 10 SDK separately, and everything is working fine now.