godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.21k stars 21.22k forks source link

.NET SDK downgrade prevents Godot build from working #66098

Open Sythelux opened 2 years ago

Sythelux commented 2 years ago

Godot version

4.0.beta1

System information

Windows 10, Vulkan, NVIDIA GeForce RTX 3070 Laptop GPU

Issue description

I installed .Net 7 preview the other day because I wanted to try something in another Project. I uninstalled it, but Godot seems to still want to use it.

when I click "Build" in the top right corner the Build fails with this message:

Found .NET SDK, but did not find dotnet.dll at [C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\dotnet.dll]

appendix: I think this issue might also accur, when downgrading from a higher dotnet 6 version to a lower one.

I would expect Godot to "Ask" Dotnet, which version it prefers and build with that, or just call dotnet.exe and not bother at all which Version it chooses. But something seems to force the newest version?

Steps to reproduce

Have .Net 6 SDK installed Install .Net 7 SDK preview Create a Godot Project with Godot-Sharp beta 1 uninstall .Net 7 SDK preview

System should still have a valid version of .Net 6 availabel, but not of .Net 7. Building the Project in Godot fails.

Minimal reproduction project

No response

akien-mga commented 2 years ago

Can you paste the output of dotnet.exe --info?

Sythelux commented 2 years ago

Can you paste the output of dotnet.exe --info?

ah, it prints the same

Found .NET SDK, but did not find dotnet.dll at [C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\dotnet.dll]

How could I mess up my installation that much? It works in VSCode and Rider with other Projects though.

I suppose this is not a Godot Bug then. Apologies.

akien-mga commented 2 years ago

dotnet.exe seems to expect that SDKs are installed as long as it finds a folder for that version. And Microsoft's own installers seem to fail deleting those folders when uninstalling SDKs, so it seems to be pretty easy to end up with a broken config.

Your C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5 folder might be empty, and if so deleting it might solve the issue.

Still, maybe we can be more clever than dotnet itself in Godot to workaround this design flaw.

Sythelux commented 2 years ago

dotnet.exe seems to expect that SDKs are installed as long as it finds a folder for that version. And Microsoft's own installers seem to fail deleting those folders when uninstalling SDKs, so it seems to be pretty easy to end up with a broken config.

This is exactly what happened.

Your C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5 folder might be empty, and if so deleting it might solve the issue.

This solved it indeed. It was just an empty folder and I could delete it.

Still, maybe we can be more clever than dotnet itself in Godot to workaround this design flaw.

I'm fine if we can't find a solid fix as this is a dotnet.exe issue. Maybe it already helps, that this ticket exists, so others find it and can fix it easily, themselves.

The issue at hand is solved now. I can Build again.