Closed zaevi closed 1 year ago
I can't reproduce it in Linux, maybe it's specific to Windows. If you open Godot with the --verbose
argument, what .NET Sdk does it report to have found?
In my case, it uses hostfxr from .NET 7.0 and the Sdk from .NET 6.0:
Found hostfxr: /usr/share/dotnet/host/fxr/7.0.0/libhostfxr.so
Found .NET Sdk version '6.0.403': /usr/share/dotnet/sdk/6.0.403
In order to avoid including all of MSBuild
in Godot, we use the MSBuild.Locator
which should find MSBuild
in your current installation and use that instead. For some reason it seems to be trying to load MSBuild, Version 15.1.0.0
. Maybe something went wrong when registering the MSBuild
path.
To register the MSBuild
path we first try to find it ourselves using our DotNetFinder
implementation which looks in the output of the dotnet --list-sdks
command (same as the .NET SDKs installed
part of dotnet --info
).
For reference, here's the output of dotnet --list-sdks
for me:
6.0.403 [/usr/share/dotnet/sdk]
7.0.100 [/usr/share/dotnet/sdk]
Also experiencing the same issue, attempting to create a C# script with --verbose enabled just prints out the same thing zaevi received. I also have the same SDK and MSBuild versions.
@nowheredevel I was asking specifically for the lines that say Found hostfxr
and Found .NET Sdk version
to know which version Godot finds and tries to use. Also, I'm assuming you are also on Windows 11?
Ohhh gotcha. Ran again, on project load it says Found hostfxr: C:\Program Files\dotnet\host/fxr/7.0.0/hostfxr.dll .NET: hostfxr initialized
and Found .NET Sdk version '6.0.401': C:\Program Files\dotnet\sdk\6.0.401
. I'm on Windows 10, but I don't think it will make that much of a difference.
@raulsntos
.NET: Initializing module...
Found hostfxr: C:\Program Files\dotnet\host/fxr/7.0.0/hostfxr.dll
.NET: hostfxr initialized
.NET: GodotPlugins initialized
.NET: Failed to load project assembly
...
Found .NET Sdk version '6.0.302': C:\Program Files\dotnet\sdk\6.0.302
Seems find the correct SDK, but I'm not sure about MSBuild.
Okay I finally solve this by reinstalling .NET 6 SDK manually.
I use Visual Studio 2022 to install and manage .NET SDK. And several days ago I upgrade VS to 17.4.0 and it brings .NET SDK 7.
Back to this issue, the path that editor found (C:\Program Files\dotnet\sdk\6.0.302
) is an empty folder now, so I guess when VS is upgrading, it removes some components from .NET 6.0.302 (but I can still use .NET 6.0.302 to create or build .net project in VS).
So I download and install .net sdk (6.0.403) manually, and it works...
I noticed, if the project has a .sln
file (generated before VS 17.4 update), then it can be compiled in Visual Studio even without the .Net 6 SDK
. You can run the project from Visual Studio by setting up a custom Launch Profile: [OC] Run+Debug Godot4 C# projects from Visual Studio
Perhaps it's dotnet CLI
related problem, like this one: https://github.com/dotnet/sdk/issues/28942
Crashes with .NET 7 specifically should be fixed by #71825.
Godot version
4.0.beta4.mono, master(.mono)
System information
Win11, dotnet6 and dotnet7 installed
Issue description
When building or creating c# solution on Godot editor, it couldn't find correct msbuild and throw like this:
dotnet info:
Steps to reproduce
Install dotnet 7 (assuming you have .net6 installed).
Create new project and create C# solution on Godot editor.
Minimal reproduction project
No response