aws / aws-dotnet-extensions-configuration

This repository hosts various libraries that help developers configure .NET applications using AWS services.
https://aws.amazon.com/developer/language/net/
Apache License 2.0
179 stars 57 forks source link

Support TargetFramework of netstandard2.0 and version bump to 5.0.4. #150

Closed heatonmatthew closed 1 year ago

heatonmatthew commented 1 year ago

Update: Support the netstandard2.0 target framework (in addition to the existing ones)

Description

I have a project where I need to use this library from .NET Framework for backward compatibility purposes. By conditionally referencing the System.Text.Json package, it's possible to build the entire solution to target netstandard2.0 and therefore be consumed from .NET Framework.

Motivation and Context

The netstandard2.0 target framework allows this package to be used by additional .NET runtimes. In my case, I need to run my solution under .NET Framework for legacy reasons.

The only issue was the System.Text.Json package which isn't included in the framework for netstandard2.0, but there is a Microsoft-supplied external package that can be used to support netstandard2.0. By conditionally including this PackageReference it only affects the netstandard2.0 target (keeping the other targets using their internally included packages).

Testing

Successfully ran the Amazon.Extensions.Configuration.SystemsManager.Tests unit test suite.

Screenshots (if appropriate)

NA

Types of changes

Checklist

License

normj commented 1 year ago

So you are using the Microsoft.Extensions.Configuration configuration framework in a .NET Framework application?

heatonmatthew commented 1 year ago

So you are using the Microsoft.Extensions.Configuration configuration framework in a .NET Framework application?

Yeah. Long story, but we need to use some of the old capabilities of .NET Framework libraries that have been (rightly) removed in their .NET Core re-incarnation. While being primarily a runtime, there are some Windows-specific capabilities that can only be accessed using it.

However, because .NET Framework 4.8 supports netstandard2.0 we're able to use all the newer ecosystem to build the application itself (e.g. Microsoft.Extensions.Configuration, Kestrel, WebHost, etc). Makes it a little less jarring.

normj commented 1 year ago

So you are using the Microsoft.Extensions.Configuration configuration framework in a .NET Framework application?

Yeah. Long story, but we need to use some of the old capabilities of .NET Framework libraries that have been (rightly) removed in their .NET Core re-incarnation. While being primarily a runtime, there are some Windows-specific capabilities that can only be accessed using it.

However, because .NET Framework 4.8 supports netstandard2.0 we're able to use all the newer ecosystem to build the application itself (e.g. Microsoft.Extensions.Configuration, Kestrel, WebHost, etc). Makes it a little less jarring.

Sounds like an interesting scenario. I'm fine adding the .NET Standard 2.0 support to unblock you. I just had a couple minor comments and then we can get this released.

heatonmatthew commented 1 year ago

Great, thanks for that.

normj commented 1 year ago

The PR has been released as part of version 5.1.0. Thanks for the PR!