Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.2.0.0

When I'm starting my project (based on Project Orleans), it comes out that a weird warning is thrown by a missing reference:

 [2015-07-26 20:03:06.970 GMT 6 INFO 100000 AssemblyLoader.Client ] User assembly ignored: C:\Users\Gutemberg\Documents\Visual Studio 2015\Projects\PI - Switch (MS)\PI.Switch.Gateway.Host\bin\Debug\Microsoft.Practices.Unity.dll
* An assembly dependency [Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] could not be loaded: 0   

Microsoft.Practices.ServiceLocation doesn't come on Unity Nuget package and I can't find it anywhere! This are causing some weird runtime behaviours on my app.

I'm using latest Unity from nuget. Attached are some screenshot that proves the dependency (ILSpy) and the project reference + Nuget package manager screens on VS.

Evidences

Is this reference really necessary? How can I get rid of it?

Thanks! Really appreciate the help.

like image 984
Gutemberg Ribeiro Avatar asked Dec 02 '25 00:12

Gutemberg Ribeiro


1 Answers

Try to get a newer version and then redirect to that specific version.

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

Any way. The following should be your missing package right?

https://www.nuget.org/packages/CommonServiceLocator/1.2.0

like image 176
Juan M. Elosegui Avatar answered Dec 03 '25 14:12

Juan M. Elosegui



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!