Which Visual Studio 2017 project type to choose for a cross-platform open-source UI-agnostic C# class library and why?

后端 未结 1 1716
长发绾君心
长发绾君心 2021-01-18 16:49

I\'ve got an idea of a C# class library I would like to develop and release to open-source. I would like to make it easily available (with recompilation if necessary) on as

1条回答
  •  清酒与你
    2021-01-18 17:21

    • .NET Standard Class Library: Maximum flexibility and should be able to use in all kinds of .NET applications/platforms (evolving, as Unity is not yet covered).
    • .NET Framework Class Library: The old bit you should also know.
    • .NET Core Class Library: Share code among .NET Core apps. It exists, as .NET Standard class library has its limitation (profile surface is usually smaller than .NET Core apps).
    • Portable Class Library (PCL): You can avoid them now, unless you do need to support legacy platforms. Use .NET Standard is better and future proof.

    You can easily run a few experiments to assert the statements I made above.

    As a library publisher myself, I choose to ship NuGet packages containing .NET Framework version, .NET Standard version, and PCL version at this moment, and would gradually drop .NET Framework and PCL versions in the long run. Many other libraries do the same.

    I also wrote a blog post to cover more,

    https://blog.lextudio.com/which-class-library-project-to-go-in-visual-studio-2015-2017-a48710cf3dff

    0 讨论(0)
提交回复
热议问题