Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference.svcmap: Could not load file or assembly Microsoft.Practices.ServiceLocation, Version=1.0.0.0

I have a simple webforms website project. The project uses Microsoft Application Block Unity 3.5 (DI Container) added via NuGet.

Now I am using this 3rd party web service. After I add Service Reference and build I get this:

Error 19 Reference.svcmap: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) App_WebReferences/MyExternalService/

So I installed Microsoft.Practices.ServiceLocation but it still keeps complaining about that assembly.

enter image description here

I tried adding this to my web.config but still doesn't work.

 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>

As soon as I uninstall Unity package, all is good. No errors and I can use the Service proxy

Tried Clean Build, etc. but nothing works.

Any idea?

like image 516
gbs Avatar asked Mar 01 '15 02:03

gbs


1 Answers

I was installing wrong package for getting reference to Microsoft.Practices.ServiceLocation

Wrong package: enter image description here

Correct package is: enter image description here

like image 100
gbs Avatar answered Sep 28 '22 01:09

gbs