Jump to content

Using .NET 5.0 for mods is possible? Will it work with 1.12.2?


Climberfx

Recommended Posts

Hello Commanders.

I'm reactivating my development on Omicron, but I have now a new machine and I wan't to do the development in OS X

So my question is, If I compile my code using .NET 5.0 will it work in KSP 1.12.2?

I ask this because in OS X version of Visual Studio, I get on this two options. .NET 3.1.19 or .NET 5.0.10 Core Runtime. There is no 4.5 here, only when I install on Bootcamp Windows version of VS.

And logically, I prefer stay in OS X to do all the development, but if 5.0 is not compatible, I will do it on Windows. Sadly.

Can any one help me with this?

Thank you all.

Link to comment
Share on other sites

Well,  this one was not expected.

It worked without any modification.

I just opened my old omicron project, and try to compile and there it go. Like a charm.

So, apparently, this version of Visual Studio Mac, have it all in.

51487362294_8ec82069b4_b.jpg

 

So, forget my question, but if anyone is trying to code for KSP on Mac, just use the latest version of Visual Studio Mac (here is 2019 - 8.10.9 (build 3)).

And because of that, my development of Omicron mod will be under OS X 100%. (I'm so happy)

Edited by Climberfx
Link to comment
Share on other sites

4 hours ago, zer0Kerbal said:

@Climberfxit  may and probably will work - but I have had experience with mods being compiled for >4.7.2 hanging during load, or crashing or spamming the log --> and when recompiled with 4.7.2 they work just fine. 

The forum instructions suggest 3.5 but you're saying 4.72 works?

Link to comment
Share on other sites

38 minutes ago, theJesuit said:

The forum instructions suggest 3.5 but you're saying 4.72 works?

Spoiler

Here’s some notes and details from the team with regards to the changes that come with KSP  1.8.0
Unity Upgrade Summary

  • KSP now runs on Unity 2019.2.2f1.
  • DX11 support. DX9 no longer supported.
  • .NET 3.5 is deprecated. So we switch it up to .NET4.x.
  • .NET 4 full API.
  • Now supporting C# 7.3 with Roslyn Compiler. Though we recommend you consider performance and Garbage generation within Unity when writing your code.
  • GPU instancing support.
  • PhysX 3.4.2 upgrade.
  • New Incremental Garbage Collector implemented.
  • Legacy particle system is gone.
  • Unity no longer supports DXT3 compressed DDS format

Project Plugin Upgrades
This is probably just for info, unlikely to be much direct correlation with mod authoring

  • TextMeshPro is now 1.2.2 in the main project, still not Unity native TMP
  • VPP is now SDK V6

Things to look out for when Updating C# Plugin DLLs

  • Change Target framework for your Mod application to .NET framework 4.x (any .NET > 4.x).

 

Link to comment
Share on other sites

8 hours ago, zer0Kerbal said:

@Climberfxit  may and probably will work - but I have had experience with mods being compiled for >4.7.2 hanging during load, or crashing or spamming the log --> and when recompiled with 4.7.2 they work just fine. 

It worked, but I didn't use 5.0. When you install VS 2019 for Mac it shows 3.1 and 5.0 core only, but when you use it, it have it all, from 3.1 to 5.0.

So I just use the one that is recommended for KSP 1.12.2, and is not 3.5 anymore, is 4.5 now.

Anyway, thank by your reply guys.

Yeah @zer0Kerbal, the first part of this post is deprecated.

3 hours ago, zer0Kerbal said:
  Reveal hidden contents

Here’s some notes and details from the team with regards to the changes that come with KSP  1.8.0
Unity Upgrade Summary

  • KSP now runs on Unity 2019.2.2f1.
  • DX11 support. DX9 no longer supported.
  • .NET 3.5 is deprecated. So we switch it up to .NET4.x.
  • .NET 4 full API.
  • Now supporting C# 7.3 with Roslyn Compiler. Though we recommend you consider performance and Garbage generation within Unity when writing your code.
  • GPU instancing support.
  • PhysX 3.4.2 upgrade.
  • New Incremental Garbage Collector implemented.
  • Legacy particle system is gone.
  • Unity no longer supports DXT3 compressed DDS format

Project Plugin Upgrades
This is probably just for info, unlikely to be much direct correlation with mod authoring

  • TextMeshPro is now 1.2.2 in the main project, still not Unity native TMP
  • VPP is now SDK V6

Things to look out for when Updating C# Plugin DLLs

  • Change Target framework for your Mod application to .NET framework 4.x (any .NET > 4.x).

 

@theJesuit, Now it uses Unity 2019.4.18f1 and .NET 4.5

Cheers!

Edited by Climberfx
Link to comment
Share on other sites

21 hours ago, Climberfx said:

When you install VS 2019 for Mac it shows 3.1 and 5.0 core only, but when you use it, it have it all, from 3.1 to 5.0.

You are mixing things. But the evolution of .NET is arguably hard to follow. A picture is worth a thousand words, so :

eKPWB3u.png

In short, there are 3 different products :
- ".NET Framework" : discontinued since v4.8 in 2019
- "Mono", historically a non-Microsoft open source version of the ".NET Framework". In the process of being absorbed by .NET (which is now open source and not owned by Microsoft anymore), will likely be a thing of the past in a few years
- ".NET Core", recently renamed just ".NET", is the currently active product.

KSP is technically running on a Mono fork, which is (almost) fully compatible with the .NET Framework.
.NET Core / .NET is a different product, and isn't compatible with the .NET framework or Mono.

Your project opened just fine because in its *.csproj file, it define that it uses .NET Framework 4.5 : https://github.com/rvalle7/Omicron/blob/96e249a4ef34cd2d33220bcc4cae9d38036b7114/Omicron/Omicron.csproj#L12
So Visual Studio used that version (Visual Studio very likely ship it, but it make sense that it doesn't offer you to create new projects with it out of the box, it's likely an option buried somewhere).

On 9/18/2021 at 5:04 AM, zer0Kerbal said:

it  may and probably will work - but I have had experience with mods being compiled for >4.7.2 hanging during load, or crashing or spamming the log --> and when recompiled with 4.7.2 they work just fine.

The issue is likely that your compiling against the .NET framework installed on your system. As I said, KSP is running on a Mono fork, not on the .NET framework, and there are a few differences, especially if you try to use v4.8.
Moreover, KSP isn't shipping the whole framework, there are entire namespaces that are missing (System.IO.Compression is a quite annoying example), because they are "optional" from Unity's point of view, and Squad didn't "check the boxes" for those options.
KSP mods should always be built against the KSP provided framework (ie, the content of your KSP_x64_Data\Managed folder), and should remove the reference to your system provided framework that is added by default when making a project in Visual Studio.

Edited by Gotmachine
Link to comment
Share on other sites

No mix here @Gotmachine.

I know .NET core is a thing and Framework is other. And there is the runtime too. In a KSP forum thread they said KSP is compatible with Framework 4.5, and is the one I use.

I just didn't specify it there. (didn't wrote "framework", but I wrote "core" where I mean core, the other ones mean to be "framework")

And I see that in the .NET core 3.1 and 5.0 are the ones that is listed when I install Visual Studio 2019 Mac, and in the past, even on windows, When I installed the add-ons for .NET core 3.5 (for old VS on Windows, where I was developing for 1.7.3), it automatically install Framework 3.5 too. So, even knowing they are different things, the versions walk together, but not exclusively.

So, when I install the new VS 2019 Mac I presumably think it will not have Framework 4.5 inside of it, but it have, like I shown on 2nd post in this thread, it have it all, frameworks from 2.0 to 4.8.

So (again), knowing Framework 4.5 is the one (compatible) for KSP 1.12.2, I use it and compile my library for Omicron for a test, and it worked flawlessly. So, this is the important thing, working.

Other thing, after some more digging I found a mod that use .NET runtime 5.0 here in the forum, "Of course I still love you".

But that is for other discussion.

52 minutes ago, Gotmachine said:

So Visual Studio used that version (Visual Studio very likely ship it, but it make sense that it doesn't offer you to create new projects with it out of the box, it's likely an option buried somewhere).

It have it, you just need to change that on project settings. But for mine, it was already on framework 4.5 when I opened. I believe because I already did the update from 3.5 when I was updating the mod in windows to new releases, but I can't remember.

Edited by Climberfx
Link to comment
Share on other sites

15 hours ago, Climberfx said:

Other thing, after some more digging I found a mod that use .NET runtime 5.0 here in the forum, "Of course I still love you".

No. It's impossible to have a KSP plugin built for .NET Core / .NET 5, because KSP isn't shipped with the corresponding CLR runtimes. That mod is using .NET 5 for the external to KSP executables it provides, not for its KSP plugin. 
It would be possible to run on .NET Core up to version 2.x if KSP used the .NET Standard 2.0 CLR (the Unity version that KSP uses does provide that option), but that would require a non trivial refactor of the KSP codebase, which is never going to happen.

Unity is a quite awkward situation, as it relies on Mono, which is severely lagging behind the now "default" .NET ecosystem, and is likely to just disappear at a middle term horizon.
They just updated to the latest Mono version which bring .NET Standard 2.1 / .NET Core 3.x / complete .NET Framework 4.8 support, in the beta versions.
But that will  likely be the end of the road for Mono in Unity.
It's unclear what they will do, but they likely won't have another choice than switching to the .NET runtime (instead of the Mono one) to provide .NET 6+ support (they already stated that they will skip .NET 5 in any case).

Link to comment
Share on other sites

No, The mod exist and run, externally for sure, but it runs. And I said 5.0 runtime, not core.

And all you write here not even close helped me with my first question on the thread, that I solved alone, as you can see on the second post, but thank you for your trying.

 

I've done here , If any moderator read this stuff, you should close this thread please, because it is already solved and have no point anymore.

Thank you!

Link to comment
Share on other sites

I was aware your issue is solved. I was just randomly chatting on the more general topic. Sorry if I annoyed you.
But still, no, that mod, like any KSP 1.8+ mod, runs on the .NET Framework 4.x : https://github.com/jrodrigv/OfCourseIStillLoveYou/blob/3a44cc650cde0ecfb116dbb0beaa375f437b3682/OfCourseIStillLoveYou/OfCourseIStillLoveYou.csproj#L12
Now, I will see myself out, sorry again :P

Link to comment
Share on other sites

24 minutes ago, Gotmachine said:

I was aware your issue is solved. I was just randomly chatting on the more general topic. Sorry if I annoyed you.
But still, no, that mod, like any KSP 1.8+ mod, runs on the .NET Framework 4.x : https://github.com/jrodrigv/OfCourseIStillLoveYou/blob/3a44cc650cde0ecfb116dbb0beaa375f437b3682/OfCourseIStillLoveYou/OfCourseIStillLoveYou.csproj#L12
Now, I will see myself out, sorry again :P

No annoying here. But if you wanna some general chat, let's do it in my mod thread, that way it helps the divulgation of it on the forum. 

;) (link on signature pic)

Link to comment
Share on other sites

3 hours ago, Gotmachine said:

I was aware your issue is solved. I was just randomly chatting on the more general topic. Sorry if I annoyed you.
But still, no, that mod, like any KSP 1.8+ mod, runs on the .NET Framework 4.x : https://github.com/jrodrigv/OfCourseIStillLoveYou/blob/3a44cc650cde0ecfb116dbb0beaa375f437b3682/OfCourseIStillLoveYou/OfCourseIStillLoveYou.csproj#L12
Now, I will see myself out, sorry again :P

But to be clear, you are wrong again.

You show again what both of us already know, KSP mod's use "framework" 4.5 (or compatible).

But I wrote there on "Of course..." about the external use of "runtime" 5.0, not framework, my dear negator.

So, NO for you too.

51494091059_6ef4397411_k.jpg

 

Edited by Climberfx
Link to comment
Share on other sites

  • 2 weeks later...
On 9/19/2021 at 10:21 PM, Climberfx said:

But to be clear, you are wrong again.

You show again what both of us already know, KSP mod's use "framework" 4.5 (or compatible).

But I wrote there on "Of course..." about the external use of "runtime" 5.0, not framework, my dear negator.

So, NO for you too.

51494091059_6ef4397411_k.jpg

 

Chillout guys ;) . You are both right. OCISLY has 3 components: the mod itself that of course is .NET Framework/Mono compatible and a .NET Core 5.0 Server and Desktop Client which are compiled for Mac, Linux and Windows .

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...