【发布时间】:2014-11-17 16:39:23
【问题描述】:
我刚刚尝试更新针对 MVVMLight 5.0 之前版本(4.4.32.1 nuget 包)运行的 ASP.NET 4.5 站点以使用 5.0.2。
现在在 Visual Studio 中一切都可以正常编译,但我在第一页查看时出现错误。本质上是这样的:
CS0012:“System.ComponentModel.INotifyPropertyChanged”类型为 在未引用的程序集中定义。您必须添加一个 引用程序集 'System.ObjectModel, Version=4.0.0.0, 文化=中性,PublicKeyToken=b03f5f7f11d50a3a'。
它发生在我的一个观点的编译时:
public class _Page_Views_Account_Development_cshtml :
MyNamespace.Web.Views.BaseView<IEnumerable<MyNamespace.Data.Models.User>> {
这是详细的编译器输出:
c:\Users\MyName\AppData\Local\Temp\Temporary ASP.NET Files\root\f7cc8ed7\c7cafde5\App_Web_development.cshtml.5f83eb8c.uumj7lsy.0.cs(34,18): error CS0012: The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
c:\Users\MyName\AppData\Local\Temp\Temporary ASP.NET Files\root\f7cc8ed7\c7cafde5\assembly\dl3\e7e549bd\cb383382_bafecf01\GalaSoft.MvvmLight.DLL: (Location of symbol related to previous error)
c:\Users\MyName\AppData\Local\Temp\Temporary ASP.NET Files\root\f7cc8ed7\c7cafde5\assembly\dl3\031e1123\6f936e46_8202d001\MyNamespace.Core.DLL: (Location of symbol related to previous error)
c:\Users\MyName\AppData\Local\Temp\Temporary ASP.NET Files\root\f7cc8ed7\c7cafde5\assembly\dl3\625906e6\c7417347_8202d001\MyNamespace.Data.DLL: (Location of symbol related to previous error)
项目层次结构本质上是:
- “Web”引用“Core”和“Data”
- “数据”引用“核心”
- 所有三个项目都引用 MVVMLight 5.0“仅限库”nuget 包。
所有三个项目都针对 .NET Framework 4.5.2。
有趣的是System.ObjectModel 似乎并不存在/工作。当我尝试通过 Visual Studio 添加引用时,它未在“程序集”或“扩展”选项卡中列出。我可以在 Reference Assemblies 的 Facades 文件夹中挖掘它,但该程序集仅包含 TypeForwardedTo 用于一堆东西的程序集属性(包括 INotifyPropertyChanged)。此外,将 Facades 程序集添加为对我的项目的引用并不能消除错误。
有什么想法吗?
【问题讨论】:
标签: c# asp.net mvvm-light