c# - The type 'IUnityContainer' is defined in an assembly that is not referenced -


i upgraded asp.net mvc/webapi project microsoft.practices.unity 3.5.1404 3.5.1406 (via nuget, released). afterwards, i'm getting compile error:

error cs0012 type 'iunitycontainer' defined in assembly not referenced. must add reference assembly 'microsoft.practices.unity, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'.

on lines like:

globalconfiguration.configuration.dependencyresolver =      new unity.webapi.unitydependencyresolver(container); 

of course, i'm not referencing 3.0.0.0, 3.5.1.0. assumption unity.webapi assembly has been compiled against earlier version of microsoft.practices.unity assembly. theoretically, you'd want fix assembly redirect, so:

  <dependentassembly>     <assemblyidentity name="microsoft.practices.unity" publickeytoken="31bf3856ad364e35" culture="neutral" />     <bindingredirect oldversion="0.0.0.0-3.5.1.0" newversion="3.5.1.0" />   </dependentassembly> 

however, doesn't seem work.

any suggestions?

this might more updated answer how upgrade unity 3.5.1 4.0.1.

the type 'iunitycontainer' defined in assembly not referenced. must add reference assembly 'microsoft.practices.unity, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'.

either via package manager console or nuget:

  • uninstall unity.mvc4
  • uninstall unity.webapi
  • update-package unity
  • install-package unity.mvc (note: no number in package name time)
  • install-package unity.aspnet.webapi

code:

  • copied container.registertypes bootstrapper.cs app_start/unityconfig.cs
  • exclude bootstrapper.cs project
  • build , run

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -