【发布时间】:2012-06-09 11:52:19
【问题描述】:
自从使用 Visual Studio 2012 RC 以来,我们在 razor 视图中使用可移植类库(.net 4.5 和 Metro 配置文件)中的类时会收到 HttpCompileException。
例外:(在谷歌上将德语翻译成英语,抱歉)
System.Web.HttpCompileException (0x80004005):
c:\Users\user\AppData\Local\Temp\Temporary ASP.NET
Files\root\1995167a\126b7c4d\App_Web_index.cshtml.1fbcdbb1.zaniprm5.0.cs(29):
error CS0012: The type 'System.Object' is not in a referenced assembly is
defined. Add a reference to the Assembly "System.Runtime, Version = 4.0.0.0,
Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a" added.
at
System.Web.Compilation.AssemblyBuilder.Compile()
System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
...
解决方案结构:
- 便携式类库(.net 4.5 和 Metro 配置文件)
- 公共类用户{ ... }
- MVC 4 (.net 4.5)
- 对可移植类库的引用
- 剃刀视图
- @model 用户
由于 Visual Studio 2012 RC 无法再添加引用“System.Runtime”。
【问题讨论】:
-
作为一种解决方法,除了 .NET 4.5 和 Metro 风格之外,您能否将可移植类库更改为面向 Silverlight 5?
标签: c# asp.net razor .net-4.5 portable-class-library