Errors with installing Prism in visual studio

二次信任 提交于 2019-12-25 07:25:35

问题


I am attempting to use the Microsoft.Practices.Prism library in a universal windows phone/windows 8.1 app in Visual studio 2013. It was working great for the first day. Today when I logged in my build would fail because it claimed it did not have a reference to Microsoft.Practices, however intellisense would pick up both Microsoft.Practices and Microsoft.Practices.Prism. So I uninstalled Prism using nuget package manager, then reinstalled it. Now I am getting this error.

I have seen posts claiming that updating nuget solved this issue but I have the most recent version (I uninstalled nuget and reinstalled)

Edit: Just for clarification prism does support 4.5 so this error does not really make much sense


回答1:


NuGet will not let you install a NuGet package into a project that is targeting a .NET framework which is not included in the NuGet package.

Your project is targeting Windows 8/Windows Store (.NETCore). The Prism.Composition NuGet package has an assembly for the full .NET Framework. NuGet considers these to not be compatible which is why you are getting the error. The Prism NuGet package may be using parts of the full .NET Framework which are not available to a Windows Store application which is why NuGet is failing.

The version number is not the problem. If your project was targeting the full .NET Framework 4.5.1 then you could install Prism.Composition which has an assembly for the full .NET Framework 4.5.

In order to install a NuGet package into a Windows Store project it would need to explicitly target Windows 8 or include a Portable Class Library (PCL) which is compatible.

There are a couple of Prism NuGet packages that contain PCLs that you might be able use instead.



来源:https://stackoverflow.com/questions/23256611/errors-with-installing-prism-in-visual-studio

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