There's a great new bunch of guidance just published representing Best Practices for creating .NET Libraries. Best of all, it was shepherded by JSON.NET's James Newton-King. Who better to help explain the best way to build and publish a .NET library than the author of the world's most popular open source .NET library?
Perhaps you've got an open source (OSS) .NET Library on your GitHub, GitLab, or Bitbucket. Go check out the open-source library guidance.
These are the identified aspects of high-quality open-source .NET libraries:
- Inclusive - Good .NET libraries strive to support many platforms and applications.
- Stable - Good .NET libraries coexist in the .NET ecosystem, running in applications built with many libraries.
- Designed to evolve - .NET libraries should improve and evolve over time, while supporting existing users.
- Debuggable - .NET libraries should use the latest tools to create a great debugging experience for users.
- Trusted - .NET libraries have developers' trust by publishing to NuGet using security best practices.
The guidance is deep but also preliminary. As with all Microsoft Documentation these days it's open source in Markdown and on GitHub. If you've got suggestions or thoughts, share them! Be sure to sound off in the Feedback Section at the bottom of the guidance. James and the Team will be actively incorporating your thoughts.
Cross-platform targeting
Since the whole point of .NET Core and the .NET Standard is reuse, this section covers how and why to make reusable code but also how to access platform-specific APIs when needed with multi-targeting.
Strong naming
Strong naming seemed like a good idea but you should know WHY and WHEN to strong name. It all depends on your use case! Are you publishing internally or publically? What are your dependencies and who depends on you?
NuGet
When publishing on the NuGet public repository (or your own private/internal one) what do you need to know about SemVer 2.0.0? What about pre-release packages? Should you embed PDBs for easier debugging? Consider things like Dependencies, SourceLink, how and where to Publish and how Versioning applies to you and when (or if) you cause Breaking changes.
Also be sure to check out Immo's video on "Building Great Libraries with .NET Standard" on YouTube!
Sponsor: Check out the latest JetBrains Rider with built-in spell checking, enhanced debugger, Docker support, full C# 7.3 support, publishing to IIS and more advanced Unity support.
© 2018 Scott Hanselman. All rights reserved.
from Scott Hanselman's Blog http://feeds.hanselman.com/~/574981582/0/scotthanselman~New-prescriptive-guidance-for-Open-Source-NET-Library-Authors.aspx
Comments
Post a Comment