c#-Unity无法加载文件或程序集’Microsoft.Practices.ServiceLocation,Version = 1.2.0.0
作者:互联网
当我开始我的项目时(基于Project Orleans),结果是丢失的引用引发了奇怪的警告:
[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不在Unity Nuget软件包上,我在任何地方都找不到!这导致我的应用程序出现一些奇怪的运行时行为.
我正在使用来自nuget的最新Unity.随附一些屏幕快照,这些屏幕快照证明了依赖关系(ILSpy)和项目参考VS上的Nuget程序包管理器屏幕.
这个参考真的必要吗?我该如何摆脱呢?
谢谢!非常感谢您的帮助.
解决方法:
尝试获取较新的版本,然后重定向到该特定版本.
<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>
随便以下应该是您丢失的包裹吧?
https://www.nuget.org/packages/CommonServiceLocator/1.2.0
标签:dependency-injection,unity-container,c 来源: https://codeday.me/bug/20191028/1949456.html