Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0

前端 未结 9 1281
情书的邮戳
情书的邮戳 2020-12-01 09:13

I have a .NET Standard 1.4 class library that references the System.ComponentModel.Annotations (4.3.0) NuGet package.

I\'m then referencing this class library from a

9条回答
  •  情深已故
    2020-12-01 09:46

    This usually happens when visual studio can't figure out the correct bindingRedirect.

    Most likely the cause it that the version of the nugget does not match the version of the produced library.

    To fix do this:

    1. From package manage console do:

      Get-Project –All | Add-BindingRedirect

      to regenerate assemblyBinding configuration at the config file

    2. If didn't fix it, then add manually the binding redirection:

      
          
          
      
      

      where:

      1. X is the version that can't be load, from the error message
      2. Y is the version on your project references. To get it, select the library from the references node, and look for the version on property pane.

提交回复
热议问题