lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

Target .NET Core #83

Open jaredthirsk opened 7 years ago

jaredthirsk commented 7 years ago

.NET Core is new from Microsoft's new cross-platform solution to support Linux/Mac/Windows. It would be great if this library could be used in that platform.

cakeslice commented 7 years ago

Yes please!

AlbinoGeek commented 7 years ago

I hate these kinds of comments, but...

+1

soccermitchy commented 7 years ago

I'll probably fork this later to at least try to do this, I could use this for one of my own projects... Hopefully, this doesn't really depend on anything that isn't in .NET Core

soccermitchy commented 7 years ago

Attempting to build it with just the default project.json from dotnet new -t Lib, getting this:

/home/mitchell/code/lidgren-network-gen3/Lidgren.Network/NetException.cs(21,22): error CS0234: The type or namespace name 'Serialization' does not exist in the namespace 'System.Runtime' (are you missing an assembly reference?)
/home/mitchell/code/lidgren-network-gen3/Lidgren.Network/Platform/PlatformWin32.cs(26,18): error CS0246: The type or namespace name 'NetworkInterface' could not be found (are you missing a using directive or an assembly reference?)
/home/mitchell/code/lidgren-network-gen3/Lidgren.Network/NetPeer.Internal.cs(18,11): error CS0246: The type or namespace name 'Thread' could not be found (are you missing a using directive or an assembly reference?)
/home/mitchell/code/lidgren-network-gen3/Lidgren.Network/NetUPnP.cs(253,11): error CS0246: The type or namespace name 'XmlDocument' could not be found (are you missing a using directive or an assembly reference?)

Not as bad as I thought it would be, but this may be a bit of a pain to port still.

soccermitchy commented 7 years ago

I also may end up having to make a compile-time flag to enable/disable encryption, with the flag disabled on netstandard, but enabled on netframework, which would allow building it for .net standard 1.6 (which is what I'm testing/porting it with)

soccermitchy commented 7 years ago

Just got it to build! Git repo URL: https://github.com/soccermitchy/lidgren-network-gen3 warning: lots of shitcode.

Supergeek commented 7 years ago

soccermitchy, I was able to compile your forked library into a DLL on my Core setup, but I'm having a hard time including the DLL, or a packed .nupkg file into a new project. Any tips for how to do that?

soccermitchy commented 7 years ago

Not 100% sure how to do it, I can look up later how to upload a package to nuget so you can just add a dep in your project.json file

On Tue, Dec 6, 2016 at 11:25 AM, Supergeek notifications@github.com wrote:

soccermitchy, I was able to compile your forked library into a DLL on my Core setup, but I'm having a hard time including the DLL, or a packed .nupkg file into a new project. Any tips for how to do that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/83#issuecomment-265195914, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbDE5TO08zFbnCGf7Av6klIZzP79MhSks5rFYxigaJpZM4J-T1r .

Supergeek commented 7 years ago

I just threw the whole library directory into my project to see if I could get it to work that way. I ran into a lot of compile issues when I did that, starting with NetUPnP, so I'm not sure if it's just me. I'm not a professional developer, so I will be the first to admit it's very likely to be operator error.

From what I'm reading, referencing a DLL is basically impossible in Core right now (except for maybe the preview build tools which I haven't tried), so people recommend making their own local nuget packages. But I'm not even sure how to reference the local nuget file instead of the internet-accessible version.

Anyway, just trying to give feedback and send encouragement on the Core front. Core+Unity users do exist and some of us need socket libraries to do all the heavy lifting for us! :)

On 12/6/2016 11:47 AM, Mitchell Monahan wrote:

Not 100% sure how to do it, I can look up later how to upload a package to nuget so you can just add a dep in your project.json file

On Tue, Dec 6, 2016 at 11:25 AM, Supergeek notifications@github.com wrote:

soccermitchy, I was able to compile your forked library into a DLL on my Core setup, but I'm having a hard time including the DLL, or a packed .nupkg file into a new project. Any tips for how to do that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub

https://github.com/lidgren/lidgren-network-gen3/issues/83#issuecomment-265195914, or mute the thread

https://github.com/notifications/unsubscribe-auth/AAbDE5TO08zFbnCGf7Av6klIZzP79MhSks5rFYxigaJpZM4J-T1r .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/83#issuecomment-265202814, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPikjkwB5vViCJ40yGUXG1G_tEh7lC6ks5rFZG7gaJpZM4J-T1r.

soccermitchy commented 7 years ago

If I remember correctly, there is a 'nuget.config' file (or similar) where you can specify custom locations for packages, either local or remote.

On Tue, Dec 6, 2016 at 12:03 PM, Supergeek notifications@github.com wrote:

I just threw the whole library directory into my project to see if I could get it to work that way. I ran into a lot of compile issues when I did that, starting with NetUPnP, so I'm not sure if it's just me. I'm not a professional developer, so I will be the first to admit it's very likely to be operator error.

From what I'm reading, referencing a DLL is basically impossible in Core right now (except for maybe the preview build tools which I haven't tried), so people recommend making their own local nuget packages. But I'm not even sure how to reference the local nuget file instead of the internet-accessible version.

Anyway, just trying to give feedback and send encouragement on the Core front. Core+Unity users do exist and some of us need socket libraries to do all the heavy lifting for us! :)

On 12/6/2016 11:47 AM, Mitchell Monahan wrote:

Not 100% sure how to do it, I can look up later how to upload a package to nuget so you can just add a dep in your project.json file

On Tue, Dec 6, 2016 at 11:25 AM, Supergeek notifications@github.com wrote:

soccermitchy, I was able to compile your forked library into a DLL on my Core setup, but I'm having a hard time including the DLL, or a packed .nupkg file into a new project. Any tips for how to do that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub

https://github.com/lidgren/lidgren-network-gen3/issues/ 83#issuecomment-265195914, or mute the thread

https://github.com/notifications/unsubscribe-auth/ AAbDE5TO08zFbnCGf7Av6klIZzP79MhSks5rFYxigaJpZM4J-T1r .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/ 83#issuecomment-265202814, or mute the thread https://github.com/notifications/unsubscribe- auth/AAPikjkwB5vViCJ40yGUXG1G_tEh7lC6ks5rFZG7gaJpZM4J-T1r.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/83#issuecomment-265207431, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbDE37j3NB4_jM1XvbCViveSgApABJ5ks5rFZVfgaJpZM4J-T1r .

soccermitchy commented 7 years ago

I just uploaded a package to NuGet for this: https://www.nuget.org/packages/Lidgren.Network.Core. For the version, I just grabbed the version from the .csproj file from the official gh repo.

On Tue, Dec 6, 2016 at 3:20 PM, Mitchell Monahan soccermitchy@gmail.com wrote:

If I remember correctly, there is a 'nuget.config' file (or similar) where you can specify custom locations for packages, either local or remote.

On Tue, Dec 6, 2016 at 12:03 PM, Supergeek notifications@github.com wrote:

I just threw the whole library directory into my project to see if I could get it to work that way. I ran into a lot of compile issues when I did that, starting with NetUPnP, so I'm not sure if it's just me. I'm not a professional developer, so I will be the first to admit it's very likely to be operator error.

From what I'm reading, referencing a DLL is basically impossible in Core right now (except for maybe the preview build tools which I haven't tried), so people recommend making their own local nuget packages. But I'm not even sure how to reference the local nuget file instead of the internet-accessible version.

Anyway, just trying to give feedback and send encouragement on the Core front. Core+Unity users do exist and some of us need socket libraries to do all the heavy lifting for us! :)

On 12/6/2016 11:47 AM, Mitchell Monahan wrote:

Not 100% sure how to do it, I can look up later how to upload a package to nuget so you can just add a dep in your project.json file

On Tue, Dec 6, 2016 at 11:25 AM, Supergeek notifications@github.com wrote:

soccermitchy, I was able to compile your forked library into a DLL on my Core setup, but I'm having a hard time including the DLL, or a packed .nupkg file into a new project. Any tips for how to do that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub

https://github.com/lidgren/lidgren-network-gen3/issues/83# issuecomment-265195914, or mute the thread

https://github.com/notifications/unsubscribe-auth/AAbDE5TO0 8zFbnCGf7Av6klIZzP79MhSks5rFYxigaJpZM4J-T1r .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/83# issuecomment-265202814, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAPikjkwB5vViCJ40yGUXG1G_tEh7lC6ks5rFZG7gaJpZM4J-T1r.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lidgren/lidgren-network-gen3/issues/83#issuecomment-265207431, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbDE37j3NB4_jM1XvbCViveSgApABJ5ks5rFZVfgaJpZM4J-T1r .

Supergeek commented 7 years ago

Much appreciated, thank you. VS Code picked it up and installed it without issue.

Then I took the Chat Server example (https://github.com/lidgren/lidgren-network-gen3/blob/master/Samples/Chat/ChatServer/Program.cs) and took out all of the Windows forms stuff and it compiled fine.

Looks good so far!

On 12/6/2016 6:39 PM, Mitchell Monahan wrote:

I just uploaded a package to NuGet for this: https://www.nuget.org/packages/Lidgren.Network.Core. For the version, I just grabbed the version from the .csproj file from the official gh repo.

willthiswork89 commented 7 years ago

I'm happy to help on this if needed. I am a professional developer and i have also been using lidgren since the original Gen1 back when we have to create our own heartbeat thread :)

lkingsford commented 6 years ago

Was your .net core code port ever merged into the mainline?

soccermitchy commented 6 years ago

As far as I'm aware, it was not, but it also was never high enough quality of a port that I didn't really consider doing a PR with it.

danielcrenna commented 5 years ago

a .NETStandard 2.0/multi-target SLN option was merged in May, this can likely be closed