structuremap / StructureMap.Microsoft.DependencyInjection

StructureMap integration for ASP.NET Core
MIT License
72 stars 29 forks source link

StructureMap reference is lowercase, causing issues #14

Closed amattie closed 8 years ago

amattie commented 8 years ago

https://github.com/structuremap/StructureMap.Microsoft.DependencyInjection/blob/070661a27d9d9e7d0d24e9b163719b86ff7037b5/src/StructureMap.Microsoft.DependencyInjection/project.json#L27

I think that dependency should be StructureMap, not structuremap. It causes issues otherwise when another referenced project tries to bring in StructureMap, or I want to pin to a newer version than the one that's referenced. The workaround is to make my own project(s) depend on structuremap, but that's kinda annoying.

Ref dotnet/cli#1821

khellang commented 8 years ago

The package ID is, and have always been, structuremap (in lowercase). Now, why project.json suddenly is case sensitive with package IDs and how the issue you linked is related, I don't know :confused:

@harikmenon @maartenba Can any of you (or someone else on the team) clarify this? Has this always been the case (for project.json)? How can you get conflicting resolution for the same package with different casing?

amattie commented 8 years ago

Check that, sorry. The issue I meant to reference is NuGet/Home#2901. Looks like it will be fixed in NuGet 3.5 via https://github.com/NuGet/NuGet.Client/pull/647.

This was frustrating to no end and caused me many many hours of pain due to super vague errors during package restoration. My dotnet restore would output a massive error dump that looked like this:

...
error: Unable to satisfy conflicting requests for 'System.Runtime.Loader': System.Runtime.Loader (>= 4.0.0) (via package/Microsoft.NETCore.App 1.0.0),
System.Runtime.Loader (>= 4.0.0) (via package/StructureMap 4.3.0),
System.Runtime.Loader (>= 4.0.0) (via package/structuremap 4.3.0),
System.Runtime.Loader (>= 4.0.0) (via package/StructureMap 4.3.0),
System.Runtime.Loader (>= 4.0.0) (via package/StructureMap 4.3.0)
...

As soon as I switched all dependencies in all my referenced assemblies to structuremap instead of mixing it up with StructureMap, my issue was fixed.

Still, because the project is named StructureMap in NuGet and thus appears as such in the autocomplete, it still seems to me that it should be up for consideration for it to me switched around in StructureMap.Microsoft.DependencyInjection.

khellang commented 8 years ago

Still, because the project is named StructureMap in NuGet and thus appears as such in the autocomplete, it still seems to me that it should be up for consideration for it to me switched around in StructureMap.Microsoft.DependencyInjection.

Yes and no. As mentioned, the package ID has always been lowercase. It is only the last package that got a mixed-case "title" because it was packaged using the new dotnet tooling. The ID is still lowercase.

I wonder why NuGet is showing the title and not the ID for autocomplete?

If we change to mixed casing, we risk breaking everyone who has already pinned using the lowercase ID, or have a different package with a lowercase ID dependency, so I'm not sure how much it helps right now. I think we need to wait until NuGet has cleaned up this mess and think about a switch then...

maartenba commented 8 years ago

The title is used as a display name in the tooling only, if the package id is lowercase then lowercase is what is happening. Title is informative, id is the "relational key".

@rrelyea may be able to shed some light on client details

khellang commented 8 years ago

I'm going to close this. I'm sorry that the lowercase dependency is causing issues, but there's not much we can do here. The package ID is lowercase, and it's what should be used. Hopefully NuGet 3.5 gets released soon, with fixes for these issues.