简体   繁体   中英

Compiling .net core DLL as a .net framework DLL

So, im writing a game Client/Server that shares 1 project.

The server is written using .net CORE, and the client needs the library to be in .net framework, so ive added a "Commons" project that builds in .net framework 3.5

However, for that reason, the server won't natively run on linux.

I was wondering, googled a bit couldn't find an actual way of doing it, but making "Commons" project a .net CORE project, but also make it possible to build his DLL in .net framework to import in the game client.

So the server would use a .net CORE version, and the Client would use a .net framework version of the same library.

Would that be possible somehow ?

Thanks for any attention !

I don't see why exactly have you chosen .NET Framework 3.5 but the solution is to compile the library against .NET Standard. The question remains how far can you go with this compilation.

.NET Framework 3.5 is not compatible with any version of .NET Standard, the earliest version is 4.5 as published in docs, here: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

Obviously, the further .NET Standard version you chose, the higher .NET version you have to pick on the client side, as standard grows continuously and hence drops support for the older frameworks.

If you could upgrade your client project to .NET 4.5, having the lib in .NET standard 1 would resolve your compatibility issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM