When can we expect the Microsoft.Aspnet.xxx.Odata packages to be compatible with Microsoft.Exetensions.DependencyInjection 2.0.0?
This is going to start to be a blocking problem soon if not corrected as more and more packages require 2.0 and cannot be upgraded because of the odata packages.
@JohnGalt1717 In the current master branch's AspNetCore flavor, Microsoft.Exetensions.DependencyInjection 2.0.0 is the version specified. I think your observation is for the classic flavor (Microsoft.AspNet.OData) which is still using Microsoft.Exetensions.DependencyInjection 1.0.0, is that correct?
Thanks.
Yes. Hoping that it gets updated so that those of us with older projects don't get locked out until we port to .net core.
@JohnGalt1717 This is the message when trying to upgrade to v2:
_Could not install package 'Microsoft.Extensions.DependencyInjection 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author._
v2 requires .NETFramework 4.6.1.
It will install on a clean .NET 4.7 project fine. It gets blocked because of the Microsoft.AspNet.OData being in the project.
Upgrading Microsoft.Aspnet.OData to target ,NETFramework 4.6.1 would break existing customer deployments targeting original .NETFramework 4.5. In your case, new dependency injection usages utilizing DependencyInjection 2.0.0.0 might need to use the AspNetCore flavor, which is under active development.
@JohnGalt1717
Ok, but right now you have a hard block on this so that 2.0.0 won't install because of Microsoft.Aspnet.Odata instead of just upgrading the other modules too.
This should be P1 also there is an another issue https://github.com/OData/WebApi/issues/1059 already exists related to this subject. Please close it in favor to https://github.com/OData/WebApi/issues/1059
Reposting my comment from #1059 for more visibility:
It doesn't seem to be as simple as the package owner just upgrading the DI nuget packages. I forked their repo and tried the upgrade myself, but was blocked because the DI 2.0 nuget packages require .NET Standard 2.0 and the Microsoft.AspNet.OData project is .NET Framework v4.5. I tried upgrading it to v4.7.1 but still no dice. See my SO post, and let me know if you can think of a way around this block.
@justintoth Multi-targeting. the csproj file needs to target 4.5 and .NET Standard 2.0. If it is consumed by a project using 4.5 it needs to have the dependancies for 4.5 which will lock you back on the DI stuff. But if consumed on .NET Standard 2.0 it should have the new dependencies which will work fine with .NET Standard 2.0 and away you go.
@JohnGalt1717 So I think you're saying that either...
or...
or...
No. All csproj files allow you to multi-target. Just make the odata package target 4.5 and 4.7.1 even and it will handle it and build 2 packages and nuget will automatically package both properly and deploy both and the right version will be used by the project it's included in with the correct limitations or not.
I think you mean .NET Framework 4.7.1 and .NET Standard 2.0. If Microsoft.AspNet.OData isn't .NET Standard 2.0 then it can't install the DI 2.0 nuget packages. However, it's not trivial to multi-target Microsoft.AspNet.OData to support .NET Standard 2.0, it's not just a simple csproj change AFAIK.
4.7.1 fully implements .NET Standard 2.0 so you can just target that and the .NET Standard 2.0 dependencies will work fine.
That's what I thought too, but it's not the case. As mentioned, I upgraded Microsoft.AspNet.OData to 4.7.1 however it still gives the error when trying to upgrade the DI nuget packages:
Could not install package 'Microsoft.Extensions.DependencyInjection 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
That's a configuration issue because per this: [https://docs.microsoft.com/en-us/dotnet/standard/net-standard] 4.6.1 is all that's needed to support .net standard 2.0
Thus this should be straight forward for the people in MS to resolve.
@all Would you please take a look the latest comments in #1059 and give us a try?
Merged the PR #1440. Please let us know any problem or file new issues. Thanks your input.