.NET targets #249
Replies: 8 comments 5 replies
-
I'm not sure I'm terribly qualified to answer this, but I'll give it a shot. I haven't used Mono/Godot for anything, really, just .net in general. .net standard is an interface. .net 5/6, mono, etc are implementations of that interface. This answer: https://stackoverflow.com/a/58273939/203870 has a good overview. In a nutshell, you can't run unit tests without an implementation. I agree, I'd talk to Godot people about this. But in general, if you target .netstandard, as long as the Mono that ships with Godot is compatible with that, it should work just fine. You should, in fact, be able to move seamlessly between the .net472 and mono implementation. And the difference between theory and practice is that in theory there is no difference. :) |
Beta Was this translation helpful? Give feedback.
-
Ok, so after going down this rabbit hole it's all still clear as mud but the tl;dr for .Net Standard seems to be that it's only intended for reusable libraries that can target any implementation, and while not deprecated it's not really useful or recommended in the world of .NET 5+. Definitely not applicable to us, which leaves us with the TFMs for Framework, Core, and .NET. |
Beta Was this translation helpful? Give feedback.
-
I had a chat with someone on the Godot discord who seemed to know what they were talking about, and confirmed: So given that advice, I see no reason not to adopt .NET SDK 6.0 and target net472 as our project standards. |
Beta Was this translation helpful? Give feedback.
-
FWIW, if I run I also have the Build Tool set to I think this does answer the previously-unanswered question of, "what version of the dot net CLI should we set as our standard?" Now as this related to #246 , and to VSStub (which is discussed there, although not modified there)... VSStub is required for debugging in Visual Studio 2019, and uses the old format for C# projects. I tested switching it to net472 just now, but unfortunately, Visual Studio 2019 cannot load it with net472 instead of v4.7.2. As @WildWeazel mentioned in #246 , v4.7.2 appears to be the Windows-specific .NET framework. What I can't fully explain is why I can build with Dot Net CLI (with VSStub as-is), and WW requires Mono or MSBuild, but it may well be a Windows vs Linux difference. My proposal at this point is to deprecate Visual Studio 2019 as a development environment, while keeping info on how to use it on our Wiki to preserve knowledge. VSStub will be removed from Development, and the latest version linked from the Wiki. Anyone who wants to use Visual Studio 2019 can add it locally. Eventually, Godot will likely update their Visual Studio support to not require old C# project formats, and to support Visual Studio 2022, and I suspect things will play more nicely then. This takes into account that Visual Studio 2019 was originally added in December when Lanzelot was attempting to use it, and that until February/March, we didn't have a supported VSCode debug configuration, which we do now. Rider support was also questionable in late February due to the situation in Ukraine, but at this point they've divested from Russia, so we have two supported debug configurations, including a powerful IDE, without having to support VS 2019 and the compatibility headaches that causes. Finally, although I used VS2019 in February/March, I don't think anyone is actually using it at this time. Getting rid of that pain point seems like the sensible way to go. |
Beta Was this translation helpful? Give feedback.
-
Bumping due to Preview 2 build issues. On May 7, WildWeazel wrote, The commit's message is But when they are set to net6.0, the GitHub Action to build the project fails, producing a build that just has the blank background with a non-working "Select Civ3 Home" link. Switching the tests back to net472 fixes the problem, and, at least on Windows (and presumably the build server, which is likely Linux) does not cause the tests to fail. I never really followed why the tests were on net6.0 when everything else was on net472, other than presumably it didn't work on Linux otherwise for some reason. But now that the build server has voted with Windows (only pickier about net6.0), we have a problem with the tests being net6.0 that we didn't have earlier. The solution could be changing the build server config so it is happier with net6.0, but I'm still confused about why we aren't all-net472 or all-net6.0. In the meantime I propose we build Preview 2 with the tests set to net472 so we don't delay it any more. Longer-term we should also make the build actually fail when it fails, and run on each merge commit, but that's another topic. Edit: Are we using net472 instead of net6 because that's what plays nice with Godot? |
Beta Was this translation helpful? Give feedback.
-
Ah, that would imply a .NET CLI solution would probably exist, then. The net472 test projects do indeed work with .NET 6 on Windows: But the net6.0 version also worked on Windows. I also found an issue in the godot-ci issue tracker that mentions this problem and provides a work-around: abarichello/godot-ci#80 So that's an option. Or finding another Godot CI solution. I don't know if the one we are using is official, it just seems to be popular. In a 5-minute search, I found a few alternate solutions, but none that advertises net6.0 support. So if the CI side is the desired place for a solution, and no one wants to dig deep into this, TheOrioli's workaround seems like it may be the easiest solution to me. |
Beta Was this translation helpful? Give feedback.
-
Revisiting this again now that the VM is ready (with 6.0). I don't know if this directly helps us, but Ubuntu just added .NET to its default repositories, meaning that you can just run
|
Beta Was this translation helpful? Give feedback.
-
I believe this is all now irrelevant with Godot 4. They will be mandating a minimum .NET target version going forward, starting with 8 in 4.4 projects. |
Beta Was this translation helpful? Give feedback.
-
Spinning off of #246 because this seems to be a larger issue than I realized.
At the start we were under the impression that Godot only uses Mono but that's not the case. Even some of the official docs now suggest using .NET (Core) SDK. What's really not clear is the implications for building, running, and testing with various target frameworks in our project files. Our current
net472
target somehow works with Mono 6.12, but not .NET 5/6. However Mono does not provide a practical way to run unit tests. I had in mind to switch tonetstandard2.1
which is supported by both and supposed to be the framework independent way forward, but that didn't work for me. And @JimOfLeisure tells me xUnit doesn't work with it either. To further complicate things, we think Godot will always package the build with its internal Mono implementation for runtime, which means that if you're using any other SDK you'll be using different frameworks between build/test and run! I think we need to do some research about how this actually works, and maybe talk to some experienced Godot people (or even the developers) to find out how to handle all this. Maybe @TinaFemea can shed some light on the compatibility issues.Beta Was this translation helpful? Give feedback.
All reactions