c# - Portable Class Library in MVC 4 / Razor with Visual Studio 2012 RC? -


since working visual studio 2012 rc httpcompileexception when using class out of portable class library (.net 4.5 & metro profile) within razor view.

exception: (german english translated on google, sorry)

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: type 'system.object' not in referenced assembly  defined. add reference assembly "system.runtime, version = 4.0.0.0,  culture = neutral, publickeytoken = b03f5f7f11d50a3a" added.     @ system.web.compilation.assemblybuilder.compile()    system.web.compilation.buildproviderscompiler.performbuild()     system.web.compilation.buildmanager.compilewebfile(virtualpath virtualpath) ... 

solution structure:

  • portable class library (.net 4.5 & metro profile)
    • public class user { ... }
  • mvc 4 (.net 4.5)
    • reference portable class library
    • razor-view
      • @model user

since visual studio 2012 rc adding reference "system.runtime" not possible more.

in views\web.config file, add following code under <system.web> section:

<compilation debug="true" targetframework="4.5">     <assemblies>         <add assembly="system.runtime, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" />     </assemblies> </compilation> 

there bunch of other assemblies may need reference, depending on types portable code using. can either add each 1 encounter error, or add full list of assemblies in c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.5\facades.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

jquery - Invalid Assignment Left-Hand Side -

gmail - Is there any documentation for read-only access to the Google Contacts API? -