asp.net - LINQ in Razor View Broken for VB -


i'm trying use linq in razor view (vb syntax) , have following:

model.typelist.select(function(i) ...) 

syntactically, correct; statement correct, , model types defined correct. however, following error within design-time:

error   12  'select' not member of 'system.collections.generic.list(of typeitem)' 

obviously select linq extension method, it's not supported in view, though dll reference there, , added namespace web.config files... why basic feature not working?

i using asp.net mvc 5.0, , note i'm using custom base page class. edit: in view using, have following imports:

@imports system.linq @imports system.collections.generic 

my root web.config file has following:

<system.web>    <compilation debug="true" targetframework="4.5.1" />     <httpruntime targetframework="4.5" />    <pages>       <namespaces>         <add namespace="system.collections.generic"/>         <add namespace="system.linq"/>         <add namespace="system.web.helpers" />         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.optimization" />         <add namespace="system.web.routing" />         <add namespace="system.web.webpages" />             </namespaces>     </pages> 

my views wb.config has following:

 <system.web.webpages.razor>     <host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=5.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />     <pages pagebasetype="custom.mvcviewpage">       <namespaces>         <add namespace="system.collections.generic"/>         <add namespace="system.linq"/>         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.optimization"/>         <add namespace="system.web.routing" />       </namespaces>     </pages>   </system.web.webpages.razor>    <appsettings>     <add key="webpages:enabled" value="false" />   </appsettings>    <system.web>     <httphandlers>       <add path="*" verb="*" type="system.web.httpnotfoundhandler"/>     </httphandlers>          <pages         validaterequest="false"         pageparserfiltertype="system.web.mvc.viewtypeparserfilter, system.web.mvc, version=5.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"         pagebasetype="custom.mvcviewpage"         usercontrolbasetype="custom.mvcviewusercontrol">             <controls>                 <add assembly="system.web.mvc, version=5.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" namespace="system.web.mvc" tagprefix="mvc" />             </controls>         </pages> 

note: app works when runs, design-time error.

at top of view file, include:

@imports system.linq 

update:

on further inspection, system.linq included. however, noticed web.config had different values targetframework attribute on <httpruntime> , <compilation> elements. setting both same, namely 4.5.1, fixed issue.

<httpruntime targetframework="4.5.1" /> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -