Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3346202
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:16:32+00:00 2026-05-18T01:16:32+00:00

If I set <compilation targetFramework=4.0> in web.config, Visual Studio 2010 shows all Linq extension

  • 0

If I set <compilation targetFramework="4.0"> in web.config, Visual Studio 2010 shows all Linq extension methods in ASPX files (not codebehinds). But when I change my project to target 3.5 (which supports Linq extension methods) Visual Studio removes the previously mentioned attribute in web.config, but Linq intellisense in APSX files goes with it as well.

Question

Is it possible to convince Visual Studio 2010 to not assume and fall back to 2.0 when editing ASPX files, so Linq extension methods would still be listed in intellisense dropdown?

Edit

Manually adding assemblies and import namespaces doesn’t do the trick as I’ve pointed out in one of my previous questions, when I didn’t know what was going on.

Problem reproduction

To reproduce this issue do the following:

  1. In Visual Studio 2010 open Asp.net MVC project properties and target NetFx 3.5
  2. Open web.config and remove targetFramework attribute if it’s still there.
  3. Write some code in the view itself (ASPX) that uses Linq extension method (ie. (new List<string>()).Any(s => string.IsNullOrEmpty())). You should see that Any is not recognised by Visual Studio 2010.
  4. Start adding one configuration setting by one in web.config. There should be no difference about Any method.
  5. Add <% @ Imports ... %> to the view. There should be no difference about Any method either.

Running the application is not a problem. It runs and it also executes Any Linq extension method. No problem with that. Design time support is the issue here.

My web.config file

This is the complete content of my web.config file, that doesn’t do the expected (I can include commented out parts as well, but that doesn’t make any difference – original Asp.net MVC 2 project template doesn’t include these either):

<?xml version="1.0"?>
<configuration>

    <system.web>

        <httpHandlers>
            <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
        </httpHandlers>

        <compilation debug="true" batch="true">
            <assemblies>
                <!--
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                -->
                <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>

        <pages enableViewState="false">
            <controls>
                <add tagPrefix="SharePoint" assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls" />
            </controls>
            <namespaces>
                <add namespace="Microsoft.SharePoint"/>
                <add namespace="System.Collections.Generic"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Web.Mvc"/>
                <add namespace="System.Web.Mvc.Html"/>
                <add namespace="System.Web.Routing"/>
                <add namespace="MyApp.Objects"/>
                <add namespace="MyApp.Web.General"/>
                <add namespace="MyApp.Web.Helpers"/>
            </namespaces>
        </pages>

    </system.web>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <remove name="BlockDirectAccessHandler"/>
            <add name="BlockDirectAccessHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
        </handlers>
    </system.webServer>

</configuration>

This is how it looks like in Visual Studio 2010. In the image you can’t see the extra line <%@ Import Namespace="System.Linq" %> that should be right after <%@ Control ... %>, but I’ve tried with and without. system.web/pages/namespaces is the global setting for this anyway.

alt text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:16:33+00:00Added an answer on May 18, 2026 at 1:16 am

    Including System.Core assembly is of course important. But doesn’t do anything is you don’t also do this next thing.

    To make everything work in Visual Studio 2010 as expected (and under framework 3.5) you have to add <system.codedom> configuration element in web.config as well. This is the part that was missing:

    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried to set the executionTimeout in the web.config file: <compilation debug=false targetFramework=4.5> <httpRuntime
This is my web.config: <?xml version=1.0 encoding=utf-8?> <configuration> <system.web> <compilation debug=true targetFramework=4.0> <assemblies> <add
I'm creating a WCF service using Visual Web Developer Express 2010. I'd like to
I want to set compilation debug=false to get release mode dll's compiled on the
I am trying to set the compilation-error-regexp-alist in a function that I add as
IF(UNIX) # CROSS COMPILATION! ON/OFF #SET(CMAKE_C_COMPILER /home/username/projects/buildroot/output/host/usr/bin/arm-linux-gcc) #SET(CMAKE_CXX_COMPILER /home/username/projects/buildroot/output/host/usr/bin/arm-linux-g++) #SET(CMAKE_C_COMPILER /home/username/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-gcc) #SET(CMAKE_CXX_COMPILER /home/username/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-g++) here
I have made a REST Web service, that works with Visual Studios WCF Test
I want to set the application name for my web app in the asp.net
I have a WCF REST service. I verified Webconfig file and all config items
I have a web-site named CCESD set up in IIS7; my application root folder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.