【发布时间】:2012-03-22 07:05:38
【问题描述】:
我在我的 ASP.NET MVC3 项目中使用类库。
为了让它工作,我做了以下工作:
- 使用区域
- 使用自定义
VirtualPathProvider - 对每个程序集使用
BuildManager.AddReferencedAssembly - 修改了 csproj 文件以添加对 Razor/wizards 的支持 (
<ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>) - 将
web.configs 从 web 项目复制到每个类库项目中
一切正常,除了剃刀视图中的智能感知。我收到这样的警告:
无法使用功能“lambda 表达式”,因为它不是 ISO-2 C# 语言规范的一部分
类库设置为使用 .NET 4。
这里还有一些其他问题解决了同样的问题
- Razor intellisense error: Feature 'extension method' cannot be used because it is not part of the ISO-2 C# language specification
- MVC 2 with VS 2010 View Building Error: Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification
但我找不到任何会强制编译器在 2.0 中运行的东西(这不会让我的视图在运行时失败吗?)
【问题讨论】:
标签: c# asp.net-mvc-3 asp.net-mvc-3-areas