Learning to develop multitargeted nuget packages for .NET targets
Here we can learn how to define, build, test, and report code coverage on a MultiTargeted Framework SDK type project.
In this project we will build a single solution that targets multiple frameworks to allow for the maximum supportability of downstream projects and solutions.
This is a sample project that simply creates an 'echo' of a string provided to the Echoer Class with the limitation of only returning the last 15 characters of the string provided. If the string is less than or equal to 15 characters then the entire string is returned. It was based on the idea that if you yell too much for an echo you'll only hear the last part of what you said.
The Project we are creating will target:
- .NET Framework 4.7 - existing legacy projects earliest version
- .NET 6 - current Long Term Support (LTS) but End of Life (EOL) late 2024
- .NET 8 - next LTS version
- .NETSTANDARD 2.0 - best practice recommendation version for support SDK projects
The Test Project will act like downstream projects by testing:
- .NET Framework 4.7
Will be tested by:
- .NET Framework 4.7
- .NET Framework 4.8
- .NET 6
Will be tested by:
- .NET 6
- .NET 7
- .NET 8
Will be tested by:
- .NET 8
- .NETSTANDARD 2.0
Will be tested by:
- .NET 5
- Target multiple .NET Frameworks in a single solution/project.
- Testing projects against anticipated downstream versions to reduce revists to this code until a new version needs support or an old version is deprecated.
- Integrate between Github, Codacy, and NuGet
- Documentation - Generate and Integrate as much documentation as required for a professional look both on NuGet.org and when consuming the package in downstream solutions.
- Use individually created downstream projects that consume specific versions of the NuGet Package for integration testing.
- More Birds with this stone - learn more things while we're here.
I hope you learned something using these projects.
Now get out there and make your own!
DanDeveloping