当我开始我的项目(基于 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>
任何方式。以下应该是您丢失的包裹吧?
关于c# - Unity 无法加载文件或程序集 'Microsoft.Practices.ServiceLocation,版本 = 1.2.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31641643/