简体   繁体   中英

.NET Framework? Or .NET Core? Or .NET Standard? Or none of the above?

I have a few private libraries and programs written in .NET with the .NET Framework 4.7.2, most of them are WinForms, but a few are already written in WPF.

I have a few base libraries used by all of the programs, then I usually have one library per program, using the base libraries and offering the business logic for this program and finally I have the program itself (executable) using the base libraries and the one busines logic library for this program to build the UI.

Now I'd like to port one or two of these programs to run on Android as well and I'd like to use Xamarin for that.

After googling I understood that I can't use .NET Framework as the basis for that anymore, because .NET Framework is Windows only. But I didn't get what else to use?


.NET Core seems to be one candidate, but if I understood it correctly, .NET Core only re-uses the same source code on different platforms, not the compiled files itself. And Microsoft is always only refering to Windows, Linux and OS X when talking about the cross-platform capabilities. What about Android? Is that covered by "Linux" in that context?

Let's say, I have to port three of my base libraries, the busines logic library and the program.

I now have the program running on Android and on Windows desktop with the same base library and business logic library source code.

All my other programs (not ported) use these three ported base libraries as well.

Now I'd like to change the code in one of my ported base libraries. I now had to recompile any program using the changed base library, I can't just change the file and be done?


.NET Standard seems to be another option. As far as I understood I can create one base library with .NET Standard and referencing that file from .NET Core or .NET Framework, is that right? But can I reference this library from Android as well (using Xamarin)?


To make a long question short... what do I have to do, to create one base library file (for instance one for accessing SQLite databases) and be able to reference this one base library file in Xamarin (for Android) and in Windows from other components using .NET Framework.

Is that even possible?

There are a few different .NET implementations, and they each serve a different purpose. The .NET framework was the original implementation, and only runs on Windows. Then, Xamarin Inc. created Mono . It was built to be an open source version of the .NET framework. Xamarin, for both Android and iOS, uses Mono as a .NET runtime because it has the smallest size and lightest footprint.

Next, the open source movement comes around, and Microsoft creates .NET core, which serves as an open-source cross-platform implementation similar to Mono. By the way, .NET core binaries run cross-platform on any .NET core runtime. Not the entire framework is implemented, and Microsoft creates the .NET Standard. It is not an implementation, it is a specification for the binary format and APIs any .NET implementation must have. (Note: I'm not completely sure of the order they were actually created and standardized).

Almost all .NET libraries should be programmed to the .NET Standard, so you can use them on any of the three implementations.

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