2014-04-13 90 views
4

我想MVVM光添加到通過的NuGet現有的項目中添加MVVM光庫,但我收到此錯誤信息:無法通過的NuGet

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框架4.0 ,4.0客戶端配置文件和4.5。有任何想法嗎?最近兩週前我沒有遇到這個問題。

回答

2

我能夠安裝,同時瞄準4.5和使用的NuGet爲「只MVVM光庫」

是否安裝https://www.nuget.org/packages/CommonServiceLocator/1.2.0首先避免問題的嗎?

+0

謝謝,我做了同樣的事情,並能夠得到MVVMLight安裝,但我確實需要CommonServiceLocator,因爲它增加了對我的首選IoC容器Autofac的支持。單獨安裝CommonServiceLocator仍會返回相同的錯誤消息。 – MoebiusStripMall

+0

它與Autofac發生衝突,並且未能卸載CommonServiceLocator的Autofac版本?這是蹩腳的,但有時我會訴諸創造一個有問題部件工作的新項目,然後手動複製舊代碼。 –

12

今天有同樣的問題。嘗試在您的Visual Studio Addins中首先安裝最新版本的Nuget!

+1

這爲我解決了它。要安裝最新的nuget,請進入Visual Studio工具菜單。去擴展和更新。轉到已安裝的軟件包並查找NuGet。點擊更新獲取最新的NuGet功能。重新啓動Visual Studio。轉到PM控制檯並鍵入: install-package MVVMLightLibs –

+1

是的,更新NuGet程序包管理器解決了我同樣的問題 – santosh

0

這聽起來像你的項目是針對.NET 4.0,而你正在安裝庫女巫與目標版本不兼容。

請找到相應版本的庫並安裝它們

1

我有同樣的問題。將Visual Studio 2012更新爲更新4,再次嘗試並且完美運行。祝你好運!