AutoMapper / AutoMapper.Extensions.Microsoft.DependencyInjection

MIT License
258 stars 79 forks source link

Downgrade Microsoft.Extensions.Options to 3.0.0 #161

Closed PatrickMcDonald closed 2 years ago

PatrickMcDonald commented 2 years ago

I added the latest AutoMapper.Extensions.Microsoft.DependencyInjection to a .NET 5 project and it pulled in .NET 6 dependencies. Downgrading Microsoft.Extensions.Options to 3.0.0 (based on the minimum .NET Core version supporting .NET Standard 2.1) might fix this, but in all honesty I'm not sure what repercussions this has.

If I change the unit test project to .NET 5.0 the tests all pass, but I don't have .NET 6 on my machine to run the TestApp.

lbargaoanu commented 2 years ago

You can use the 6.0 version on .Net 5.

PatrickMcDonald commented 2 years ago

Fair enough.

AFAICT, this involves me upgrading upstream and downstream dependencies to explicitly reference the 6.0 version, rather than implicitly using the 5.0 version in the .net sdk or else start dealing with binding redirects. I would love to be corrected here, as there must be an easier way.

What features of the 6.0 version are you using that you can't reference the 3.0 version? As you are targeting netstandard2.1 and not net6.0, I'm not sure I understand the reason for bumping the dependency version higher than is needed.

For reference, the Microsoft.Extensions.Logging.Log4Net.AspNetCore package multitargets netcoreapp3.1;netstandard2.0;netstandard2.1;net5.0;net6.0 and has different (appropriate) versions references for each target version. https://github.com/huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore/blob/develop/src/Microsoft.Extensions.Logging.Log4Net.AspNetCore/Microsoft.Extensions.Logging.Log4Net.AspNetCore.csproj

lbargaoanu commented 2 years ago

We're using an implementation package, I don't see why we would use a version other than the latest. You're free to use whatever :)

PatrickMcDonald commented 2 years ago

Hi, one reason to use a version other than the latest is if you are publishing a library rather than an application. If you extend your logic, why target .NET Standard 2.1 at all, why not just target .NET 6.0?

Anyhow, sorry for taking up your time. I guess I can just stick with an older version of AutoMapper until I can upgrade all our applications to .NET 6

github-actions[bot] commented 2 years ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.