c# - 在可移植项目中找不到“GalaSoft”MvvmLight

标签 c# windows-phone-8 mvvm-light

我克隆了一个解决方案,它包含多个基于 GalaSoft MvvmLight 库的项目,还有两个可移植项目。我已经安装了所有必需的 nuget 包和引用,但我无法构建这些可移植项目,并且需要先构建这些可移植项目,因为所有其他项目都引用它。
我在使用 GalaSoft 的每个文件中都遇到了这个(如下)错误。它是一个可移植类库项目。

Error 64 The type or namespace name 'GalaSoft' could not be found (are you
missing a using directive or an assembly reference

我在这个项目中引用了这个(下面)Portable MvvmLight 库

\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.dll
\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.Extras.dll

这是平台目标
portable project platform-target


我尝试清理并重新启动 visual studio。我在这个问题上停留了 2 天多了。此外,我尝试在配置管理器中选中和取消选中“构建”选项(我在某处阅读过)但没有奏效。

此外,还有其他 44 个警告。所有这些看起来都类似于以下警告。

Warning 28 The primary reference "GalaSoft.MvvmLight" could not be resolved
because it has an indirect dependency on the framework assembly "System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile158". To resolve this problem, either remove the reference "GalaSoft.MvvmLight" or retarget your application to a framework version which contains "System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

编辑: 修改题名

最佳答案

所以你的问题是 mvvm light 没有针对你的 PCL 配置文件的包。

当您使用 nuget install MvvmLightLibs 下载程序包时,您可以看到该程序包仅包含一个 PCL 配置文件的程序集。 Mvvm light 支持 portable-net45+wp8+wpa81+netcore45+monoandroid1+xamarin.ios10。但是您的 PCL 目标是 .NETPortable,Version=v4.5,Profile=Profile78。 如果您不希望您的项目与 mvvm light 兼容,则必须删除 sl5 目标。

enter image description here

关于c# - 在可移植项目中找不到“GalaSoft”MvvmLight,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30381123/

相关文章:

c# - 通过 C# 访问 Azure 中的 keyvault 时引发异常

c# - Windows 应用商店应用程序的 NSoup 替代方案

sqlite - 找不到 SDK SQLite.WP80 Xamarin 和 Azure 构建错误

c# - Xamarin Android 数据绑定(bind)与 MVVM Light

c# - 带有 StreamWriter 的 NetworkStream 在 Linux 上的行为是否有所不同?

c# - 使用索引迭代 C# 字典的键?

c# - 来自 Windows Phone 8 的 XML HTTP Post 请求

windows-phone-8 - Windows Phone 8 中 DataTrigger 的替代品是什么

windows-phone-7 - 全景 wp7 mvvm 中的静态和动态全景项目

c# - 如何从 ViewModel 读取 TextBox 焦点 - MVVM Light