• Godot Help
  • Cant build C# project after project upgrade from Godot 3.5 to Godot 4.0

I upgraded my project from Godot 3.5 to 4.0. Trying to build it in visual studio but this error happens

Package GodotSharp 4.0.0 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package GodotSharp 4.0.0 supports: net6.0 (.NETCoreApp,Version=v6.0)

I have net6 in .scproj

and have sdk installed

What did i forgot?

You may need to delete the .csproject and .sln files - at least that is what I had to do when migrating a Godot 3.X plugin to Godot 4.0. I would try that and see if it helps.

    Hmm, normally that fixes most C# project errors for me. Unfortunately I am not well versed in how Godot and C# detection works but my guess is that there might be a system path variable or something that tells Windows what version of .Net you have installed and that is not working. I do not know what the fix would be though…

    I might ask on the Godot Community chat and see if a Godot developer there knows. I think there’s a C# channel and I imagine the they could at least point you to someone who may know the answer.

      a year later

      You may need to delete the .csproject and .sln files - at least that is what I had to do when migrating a Godot 3.X plugin to Godot 4.0. I would try that and see if it helps.

      This helped me. I deleted the following files and folders:

      1. mono
      2. .godot/mono
      3. The sln file
      4. The csproj file

      Then I open the project again and ran it and the project built and ran.