无法通过NuGet添加MVVM灯光库

无法通过NuGet添加MVVM灯光库,nuget,mvvm-light,Nuget,Mvvm Light,我试图通过NuGet将MVVM Light添加到现有项目中,但收到以下错误消息: Attempting to resolve dependency 'MvvmLightLibs (≥ 4.2.30.0)'. Attempting to resolve dependency 'CommonServiceLocator (≥ 1.2)'. Successfully installed 'CommonServiceLocator 1.2'. Successfully installed 'MvvmLi

我试图通过NuGet将MVVM Light添加到现有项目中,但收到以下错误消息:

Attempting to resolve dependency 'MvvmLightLibs (≥ 4.2.30.0)'.
Attempting to resolve dependency 'CommonServiceLocator (≥ 1.2)'.
Successfully installed 'CommonServiceLocator 1.2'.
Successfully installed 'MvvmLightLibs 4.3.31.1'.
Successfully installed 'MvvmLight 4.2.30.0'.
Successfully uninstalled 'CommonServiceLocator 1.2'.
Install failed. Rolling back...
Could not install package 'CommonServiceLocator 1.2'. You are
trying to install this package into a project that targets
'.NETFramework,Version=v4.0,Profile=Client', but the package
does not contain any assembly references that are compatible
with that framework. For more information, contact the package
author.

我已经尝试将我的项目重新定位到.NET framework 4.0、4.0客户端配置文件和4.5。有什么想法吗?就在两周前,我还没有遇到这个问题。

我可以在针对4.5并使用Nuget“仅适用于MVVM Light库”的情况下进行安装


先安装是否可以避免此问题?

今天也遇到了同样的问题。首先尝试在Visual Studio加载项中安装最新版本的Nuget

在安装与目标版本不兼容的库时,听起来您的项目的目标是.NET 4.0


请找到合适版本的库并安装它们

我也有同样的问题。将Visual Studio 2012更新为更新4,然后重试,效果非常好。祝你好运

谢谢,我做了同样的事情,并且能够安装MVVMLight,但是我确实需要CommonServiceLocator,因为它增加了对Autofac的支持,Autofac是我首选的IoC容器。单独安装CommonServiceLocator仍会返回相同的错误消息。是否与Autofac冲突,以及未能卸载CommonServiceLocator的Autofac版本?这很蹩脚,但有时我会求助于创建一个新项目,让问题部分正常工作,然后手动复制旧代码。这为我解决了这个问题。要安装最新的nuget,请进入Visual Studio工具菜单。转到扩展和更新。转到已安装的软件包并查找NuGet。单击更新以获取最新的NuGet功能。重新启动VisualStudio。转到PM控制台并键入:install package MVVMLightLibsYes,更新NuGet包管理器解决了我的相同问题