Skip to content
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

Redot cannot find .net SDK. #669

Open
Shiftyhead2 opened this issue Oct 11, 2024 · 7 comments
Open

Redot cannot find .net SDK. #669

Shiftyhead2 opened this issue Oct 11, 2024 · 7 comments

Comments

@Shiftyhead2
Copy link

Tested versions

-Reproducible in: Redot mono build

System information

Windows 10 Redot mono build

Issue description

When trying to launch a project with Redot mono build it returns these two errors:
Could not resolve SDK "Godot.NET.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
Unable to find package Godot.NET.Sdk with version (= 4.4.0-dev)

  • Found 103 version(s) in nuget.org [ Nearest version: 4.4.0-dev.1 ]
    MSB4276: The default SDK resolver failed to resolve SDK "Godot.NET.Sdk" because directory "c:\program files\dotnet\sdk\8.0.110\Sdks\Godot.NET.Sdk\Sdk" did not exist.
    MSB4236: The SDK 'Godot.NET.Sdk/4.4.0-dev' specified could not be found.

Steps to reproduce

1.Open an empty Redot C# project
2. Build a C# solution by going Tools -> C# -> Create C# solution
3.Create an empty scene
4. Run the project

Minimal reproduction project (MRP)

test.zip

@Rockdtben
Copy link

I was able to reproduce the issue.

@Spartan322 Spartan322 added the bug label Oct 11, 2024
@mr-rusty-shackleford
Copy link

mr-rusty-shackleford commented Oct 11, 2024

I have a bit to learn with regards to contributing a fix to the code here but I can offer more specifics on what the issue is. The first line of the .csproj file associated with the project is:
<Project Sdk="Godot.NET.Sdk/4.4.0-dev">

This doesn't exist in nuget.org. Looks like it is now this:
<Project Sdk="Godot.NET.Sdk/4.4.0-dev.3">

If you update your .csproj file to include the .3, it should build. Has the "works on my machine" stamp of approval, anyway.

@foxication
Copy link

foxication commented Oct 12, 2024

As stated in official documentation

By default, all development builds share a version number, which can cause some issues with caching of the NuGet packages. To solve this issue either use GODOT_VERSION_STATUS to give every build a unique version or delete GodotNuGetFallbackFolder after every build to clear the package cache.

Basically the solution for maintainers is to set the env variable GODOT_VERSION_STATUS to specific version before building the packages (in other words running build_assemblies.py). For example, enter command in powershell:

$env:GODOT_VERSION_STATUS = "dev3"

This will tell MSBuild to find Godot.NET.Sdk/4.4.0-dev.3 in global directories or download from nuget.org

@foxication
Copy link

It also implies that maintainers have to upload packages to nuget.org

@jardaroh
Copy link

I'm also having this issue.

@valkyrienyanko
Copy link

For anyone having this issue here is how you can solve it.

  1. Delete the CSharpFolder in the Redot folder
  2. Copy and paste the CSharpFolder from https://godotengine.org/article/dev-snapshot-godot-4-4-dev-3/ to the Redot folder
  3. Restart Redot. Notice how the issue is gone.

Above steps should auto change your .csproj but just double check your .csproj has the following

<Project Sdk="Godot.NET.Sdk/4.4.0-dev.3">

@foxication
Copy link

There is also an alternative solution for you
(so there is no need to rewrite .csproj every time you start the Redot engine)

Use the command

dotnet nuget add source "C:\your_location\redot-editor-mono\GodotSharp\Tools\nupkgs" --name "Redot Packages v4.4-dev"

Remember to remove the package source when moving or uninstalling the Redot engine.

dotnet nuget remove source "Redot Packages v4.4-dev"

If you are using Visual Studio, there is another additional way to manage sources:
https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants