dotnet: System.ComponentModel.Annotations assembly not found error again

I don’t know which of the many Microsoft teams to post this with. Last time we updated our NuGet packages, we had this error and now when we just did it recently it happened again. We updated to 4.4.0. And the project file of a particular Test project type ends up with this: <Reference Include="System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.ComponentModel.Annotations.4.4.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath> </Reference> And it complains it can’t find ver 4.2.0.0. But when I change it manually it doesn’t seem to help… it now fails to find that version. I know previously there was something really messed up like it was actually 4.0.2.0 not 4.2.0.0 or whatever… so we had to manually fix the project or app.config file. I have no idea how to find that version number now (Windows 10 details of a DLL no longer see to show assembly versions, just file version which is 4.6.25519.3.

What the heck is going on? When is this absurd thing going to get fixed? Lots of posts about this weird versioning problem… it’s as if the old VB6 days are back with DLL hell.

I don’t understand why anything needs to show up in app.config anyway for these DLL references when it’s all done through NuGet. What a mess. I’m going to try with today’s update of 4.4.1 … 1st attempt was that all kinds of references failed. Undoing that and will try again later.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

My comments from above are still the current state of the world. .NET Framework web projects don’t support automatic binding redirects, you have to manually add them to your web.config, but usually you’ll get warnings you can double click and the will add the correct binding entries in your web.config file.

" When binding conflicts occur, you’ll get a warning in the Error List. "

I was getting a run-time error. I commented out the dependent assembly section from my web config and ran it again. It breaks when attempting to use the DbContext. The error in this screenshot is happening during the IOC container resolution.

image

Same problem here

So I had to manually add <dependentAssembly> <assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> To the app.config file of the project to make it work. But this test project has been working for months and this ComponentModel.Annotation section in the app.config was NOT in there. I just verified in our repo history.