Skip to content

Update dependencies for .net core 2.0 package dependencies #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hikalkan opened this issue Aug 17, 2017 · 30 comments
Closed

Update dependencies for .net core 2.0 package dependencies #1059

hikalkan opened this issue Aug 17, 2017 · 30 comments
Assignees
Labels
Milestone

Comments

@hikalkan
Copy link

Microsoft.AspNet.OData package has following dependencies:

  • Microsoft.Extensions.DependencyInjection (>= 1.0.0 && < 2.0.0)
  • Microsoft.Extensions.DependencyInjection.Abstractions (>= 1.0.0 && < 2.0.0)

As you have seen it depends on older version of the packages. So, they are preventing me to upgrade my solution to use new versions of these packages.

Have you planned to upgrade it?

@genusP
Copy link
Contributor

genusP commented Aug 17, 2017

See PR #1058

@hikalkan
Copy link
Author

Thank you, that's very good :)

@xuzhg xuzhg added the P4 label Aug 30, 2017
@JanEggers
Copy link

@xuzhg : are there any builds of this? on your myget feed there is only Microsoft.AspNet.OData but no Microsoft.AspNetCore.OData

@xuzhg
Copy link
Member

xuzhg commented Sep 26, 2017

@JanEggers No. See the comments from #939

@millman82
Copy link

millman82 commented Oct 18, 2017

@genusP The linked PR seems to be only adding this support for Microsoft.AspNetCore.OData. Is this going to be updated for Microsoft.AspNet.OData? We're converting some of our shared libs to .NETStandard 2.0 and we've replaced Unity with Microsoft.Extensions.DependencyInjection. I need the ability to use Microsoft.Extensions.DependencyInjection 2.0.0 in conjunction with Microsoft.AspNet.OData.

@genusP
Copy link
Contributor

genusP commented Oct 19, 2017

@millman82 PR #1082 add compatibility with Microsoft.Extensions.DependencyInjection 2.0.0

@ismcagdas
Copy link

Are there any progress on this ?

@justintoth
Copy link

+1

1 similar comment
@titobf
Copy link

titobf commented Apr 25, 2018

+1

@justintoth
Copy link

Still completely blocked on upgrading our odata api to the latest nuget packages, due to Microsoft.AspNet.OData not supporting DI 2.x. It's not as trivial as wanting to upgrade nuget packages, we have other shared code that uses the latest nuget packages, so it means we can't even reference our other shared libraries in our odata api project, it's completely quarantined for the time being. It's not like this is a 3rd party package, this is from Microsoft itself, so it's really disappointing that you wouldn't stay up to date. Someone, please fix this, we've been waiting almost a year now....

@lesair
Copy link

lesair commented May 2, 2018

Any ETA for this yet?

@cilerler
Copy link

cilerler commented May 2, 2018

P4? It should be P1, just saying 😠

@kieseld
Copy link

kieseld commented May 2, 2018

Blocking issue for us as well.

@lesair
Copy link

lesair commented May 2, 2018

@kieseld You're not alone. Blocking us too here.

@stephenpope
Copy link

Blocked also.

@cilerler
Copy link

cilerler commented May 3, 2018

Please also click on 👍 in the initial request, so owner can see at first glance this shouldn't be P4

@lesair
Copy link

lesair commented May 3, 2018

@cilerler Done.

@justintoth
Copy link

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.

@stephenpope
Copy link

stephenpope commented May 3, 2018

@justintoth This is exactly what I've started to do today. The reasons you listed in your SO post are pretty much identical to mine. We have a product we are trying to upgrade to use netcore 2.0 libraries even though we still run some parts on full framework and this is where we ran into this issue. If I figure anything out I'll let you know !

It would seem that this pull request : #1082 makes it compatible with DI 2.0 so do i just need to manually build a nuget package with a different nuspec ?!

@stephenpope
Copy link

!! Hack warning !!

Thought I would post what we found when looking at ways to get around this .. you can disable some error/warning messages using the MSBuild features if you are using PackageReferences in your csproj (rather than using packages.config)

<ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0">
        <NoWarn>NU1608</NoWarn>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0">
        <NoWarn>NU1608</NoWarn>
    </PackageReference>
    <PackageReference Include="Microsoft.Aspnet.Odata" Version="6.1.0">
</ItemGroup>

So your project should now build happily so you get DI v2 + oData 6.10 .. but then the issue is the breaking change between DI 1.0 + DI 2.0.

Then you can look at how to replace the DefaultContainerBuilder implementation with the reflection based one from #1082 - which works with DI v1 + DI v2 (but is in the master branch for 7.0.0).

Hopefully this can be achieved using what is talked about here: https://odata.github.io/WebApi/13-04-DependencyInjection/

Still would be better if this was fixed officially :)

@justintoth
Copy link

@stephenpope I went down this path originally, unfortunately I found that it made it so that the nuget package manager would no longer upgrade ANY package. Let me know what your experience is.

@mikepizzo mikepizzo added P2 and removed P4 labels May 15, 2018
@christophwille
Copy link

Also blocked by this (EF Core in ASP.NET "classic")

@xuzhg xuzhg added P1 and removed P2 labels May 17, 2018
@xuzhg xuzhg added this to the v7.0 milestone May 17, 2018
@xuzhg
Copy link
Member

xuzhg commented May 17, 2018

@christophwille @justintoth @stephenpope @cilerler @hikalkan and others

Would you please try the nightly build Microsoft.AspNet.OData, version 7.0.0-Nightly201805162258.
The source is: https://www.myget.org/F/webapinetcore/api/v3/index.json

image

It seems work at my side, please make sure what i did correct:

1 . VS2017, create a console application with classic windows desktop
2. Install nightly package. Version 7.0.0-Nightly201805162258
3. Write some codes in the program.cs.
for example:

    class Program
    {
        static void Main(string[] args)
        {
            var builder = new ODataConventionModelBuilder();
            builder.EntitySet<Customer>("Customers");
            IEdmModel model = builder.GetEdmModel();

            foreach (var element in model.SchemaElements)
            {
                Console.WriteLine(element.Name);
            }
        }
    }

    class Customer
    {
        public int Id { get; set; }
    }
  1. Build and run. you will get result.
  2. Go to nuget package manager
  3. Update the dependencyinject to version 2.0
  4. Build & run. you will get the same result.

Please try and let me know any concern.

@christophwille
Copy link

Did a test on our real solution (heck, that's why we have source control). Target FW 4.6.2.

Step 1 - added the Nuget you specified. Had to touch a total of 14 files. (old was 6.1)

using System.Web.OData; -> using Microsoft.AspNet.OData;
using System.Web.OData.Routing; -> using Microsoft.AspNet.OData.Routing;
using System.Web.OData.Builder; -> using Microsoft.AspNet.OData.Builder;
(and a few more similar to those)

Runs as before (msgraph calls, az storage, you name it)

Step 2 - added EF Core 2.0.3 (which didn't work before). That worked.

Step 3 - referenced our EF Core project into the Web. Tried a context. Worked.

So can confirm this fixes a real-world project. (but we cannot use the nightly, obviously)

@xuzhg
Copy link
Member

xuzhg commented May 17, 2018

@christophwille Thanks for your trying.

@justintoth
Copy link

@xuzhg @christophwille How are you guys installing the nightly build?

PM> Install-Package Microsoft.AspNet.OData -Version 7.0.0-Nightly201805162258
GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.aspnet.odata/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.aspnet.odata/index.json 199ms
Install-Package : Unable to find version '7.0.0-Nightly201805162258' of package 'Microsoft.AspNet.OData'.
At line:1 char:1

  • Install-Package Microsoft.AspNet.OData -Version 7.0.0-Nightly20180516 ...
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
    

Time Elapsed: 00:00:00.4022642

@cilerler
Copy link

cilerler commented May 18, 2018

@justintoth
Copy link

justintoth commented May 18, 2018

Just figured that out, never used a source other than nuget before. Unfortunately it didn't work for me, the nightly build still shows as not supporting DI 2.0.

odata

Restoring packages for C:\RPR-AMP-Upstream\Dev\MetaMan\MetaMan.Api\MetaMan.Api.csproj...
Detected package version outside of dependency constraint: Microsoft.AspNet.OData 7.0.0-Nightly201805181243 requires Microsoft.Extensions.DependencyInjection (>= 1.0.0 && < 2.0.0) but version Microsoft.Extensions.DependencyInjection 2.0.0 was resolved.
Detected package downgrade: Microsoft.Extensions.DependencyInjection.Abstractions from 2.0.0 to 1.1.1. Reference the package directly from the project to select a different version.
MetaMan.Api -> Microsoft.Extensions.DependencyInjection 2.0.0 -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.0.0)
MetaMan.Api -> Microsoft.Extensions.DependencyInjection.Abstractions (>= 1.1.1)
Package restore failed. Rolling back package changes for 'MetaMan.Api'.

@xuzhg
Copy link
Member

xuzhg commented May 18, 2018

@justintoth Please select version: 7.0.0-Nightly201805162258 to try.

Not all version can work because i haven't merge my PR yet.

@xuzhg
Copy link
Member

xuzhg commented May 21, 2018

Merged the PR. #1440. Please let us know if you have further concerns or questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests