Where is Microsoft.Practices.Unity package?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 04:22:07

问题


An hour ago I updated my nuget packages for the solution I'm working on and I get the error message, thrown by Unity, that

The type 'IUnityContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f'.

Since then I have been googling to get some usable information about that where this package is. The articles, question around it are old, deals with 2.x version.

There is no such package in Nuget.

I have the packages listed below from Unity stack installed:

  <package id="Unity" version="4.0.2" targetFramework="net452" />
  <package id="Unity.ServiceLocator" version="2.0.0" targetFramework="net452" />
  <package id="Unity.WebAPI" version="5.2.3" targetFramework="net452" />

Any help is appreciated!


回答1:


After adding the nuget with

Install-Package Unity

it is located in

packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll 

You probably just need to add a reference to this assembly.




回答2:


I had to change

using Microsoft.Practices.unity;

to

using Unity;

I think because of an update in Unity with NuGet




回答3:


Update Unity with Nuget. I use NuGet Package Manager instead of command line. Access Manager by right-clicking the solution in the Solution Explorer from Visual Studion



来源:https://stackoverflow.com/questions/35674014/where-is-microsoft-practices-unity-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!