Skip to content
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

Microsoft.Windows.Compatibility depends on nonexistent System.ComponentModel.Composition package #25212

Closed
nblumhardt opened this issue Feb 27, 2018 · 8 comments

Comments

@nblumhardt
Copy link

Guessing this may have already been noted elsewhere, but took me by surprise - the MEF1 work for the Windows Compatibility Pack hasn't been done yet (mentioned on #23974), but Microsoft.Windows.Compatibility still declares it as a package dependency.

The NuGet client falls back to installing this unlisted non-Microsoft package uploaded in 2010:

https://www.nuget.org/packages/System.ComponentModel.Composition

error NU1603: Microsoft.Windows.Compatibility 2.0.0-preview1-26216-02 depends on 
System.ComponentModel.Composition (>= 4.5.0-preview1-26216-02) but 
System.ComponentModel.Composition 4.5.0-preview1-26216-02 was not found. An approximate best 
match of System.ComponentModel.Composition 2010.2.11 was resolved.
@nblumhardt nblumhardt changed the title Microsoft.Windows.Compatibility pulls in unlisted non-Microsoft MEF1 package Microsoft.Windows.Compatibility depends on nonexistent System.ComponentModel.Composition package Feb 27, 2018
@nblumhardt
Copy link
Author

I'm used to this being a warning, but seems at least in my build it's an error, so the unlisted package doesn't end up being installed. Not sure if this will be the case for everyone, but updated the issue title to reflect this.

@nblumhardt
Copy link
Author

Sorry, another addition - I didn't realize the package has been rev'd; the one I'm installing is:

Microsoft.Windows.Compatibility 2.0.0-preview1-26216-02

@danmoseley
Copy link
Member

@weshaggard

@weshaggard
Copy link
Member

@nblumhardt Yes we are missing System.ComponentModel.Composition on nuget.org right now as someone was sitting on that package id and we are trying to get ownership of it. Until that happens you can fix this by adding our myget feed to your package sources.

@nblumhardt
Copy link
Author

Thanks @weshaggard @superriva - I don't actually need the package, just wanted to make sure no one inadvertently installed "mystery" code via this route 👍

@NBaron
Copy link

NBaron commented Mar 2, 2018

@superriva I am trying to use the package on myget in a NetStandard2 library.
I am porting from a NetFramework4.6.1 library using MEF1.
Everything looks good till I get to the use of RegistrationBuilder which is a CustomReflectionContext (System.ComponentModel.Composition.Registration).
It is apparently not present in the myget package and I would like to know how can we achieve something similar; like filtering the exports.

E.g.:

var conventions = new RegistrationBuilder();
conventions.ForTypesDerivedFrom<ILogger>()
                    .ExportInterfaces(t => t != typeof(ILogger)); // Exporte le logger
conventions.ForTypesMatching(t => t.IsClass && !t.IsAbstract && PLAN_TYPE.IsAssignableFrom(t))
                   .ImportProperties(pi => PLAN_VALUE_TYPE.IsAssignableFrom(pi.PropertyType));

var globalCatalog = new AggregateCatalog(
                   globalAssemblies.Select(a => new AssemblyCatalog(a,  conventions)));

Thanks in advance.

@danmoseley
Copy link
Member

@NBaron we have now published the package correctly so this issue is fixed -- if yo'ure still having trouble with MEF porting as above could you please open a new issue?

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants