sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.03k stars 1.11k forks source link

Roslyn: How to get all projects from a solution (old vs. sdk style csproj) #994

Closed sschmid closed 2 years ago

sschmid commented 2 years ago

Hi!

I'm having an Roslyn issue, sounds simple, but can't get it to work:

Task:

Problem:

I created a test repo to test this in isolation https://github.com/sschmid/RoslynTest

This will be very useful for the Entitas code generator.

Does anyone how to fix this?

JesseTG commented 2 years ago

I don't know how exactly this is solved, but I know that Genesis has solved it. This is the directory you'll want, I think. Does that help?

sschmid commented 2 years ago

Yeah, he's using MSBuildLocator.RegisterDefaults() from Microsoft.Build.Locator. Unfortunately:

Operation is not supported on this platform

Only works on Windows

I'm using mono-hosted-msbuild https://github.com/dotnet/msbuild/releases/mono-hosted-msbuild-v0.03

to be able to run roslyn on macOS and linux

sschmid commented 2 years ago

But I was about to try that with GitHub actions on a windows hosted machine. Let's see if that works

sschmid commented 2 years ago

I will move discussion to: https://github.com/sschmid/RoslynTest/issues/1

JesseTG commented 2 years ago

Hey @jeffcampbellmakesgames, what do you think?

sschmid commented 2 years ago

Solved.

Entitas and Desperate devs was .NET 4.x to be compatible with Unity.

Jenny however can be net5.0 or newer. Using net6.0 fixes it 😍

jzapdot commented 2 years ago

Yeah, he's using MSBuildLocator.RegisterDefaults() from Microsoft.Build.Locator. Unfortunately:

Operation is not supported on this platform

Only works on Windows

I believe this might have been the case for the .Net Framework version, but on .Net Core 3 this was not the case (supports Windows, macOS, and Linux). That is why Genesis works on all three platforms as a portable app.

Solved.

Entitas and Desperate devs was .NET 4.x to be compatible with Unity.

Jenny however can be net5.0 or newer. Using net6.0 fixes it 😍

Going with latest .Net Core is definitely the way to go! I've seen some issues on macOS on Silicon machines where the .Net 3 SDK can be installed, but not the runtime (which may or may not be by design depending on some Github issues I'd seen). It's one of the reasons I'll be updating to .Net 6 in the near future as well (along with the bevy of other awesome perf benefits and other handy features).