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

  • Home
  • SEARCH
  • 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 3270728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:39:57+00:00 2026-05-17T18:39:57+00:00

Our application is built with VS 2008, uses Linq and has Target Framework set

  • 0

Our application is built with VS 2008, uses Linq and has Target Framework set to .NET Framework3.5.

It works OK when only .NET 3.5 or 4 is installed on the machine.

However, on machines where both .NET 2 (or 3.0) and .NET 4 are installed, the application is loaded with .NET 2, and crashes when Linq is accessed, as it looks for the .NET 3.5 libraries.

Using the tag in app.config doesn’t seem to help, as it specifies the CLR version, which is 2 in case of .NET 3.5.

Note that our installation verifies that .NET 3.5 or upper is installed.

Is there a way to tell the application to load:

  • the highest CLR it finds, or
  • CLR 4 if it is installed, and CLR 2 if CLR 4 is not installed, or
  • CLR 2 if .NET 3.5 is installed and CLR 4 if .NET 3.5 is not installed

(Note that similar question is left unanswered in the Community Content section of the Element documentation)

  • 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-17T18:39:57+00:00Added an answer on May 17, 2026 at 6:39 pm

    Forming the question led me to the answer. As mentioned in the Element documentation,

    When multiple versions of the runtime
    are supported, the first element
    should specify the most preferred
    version of the runtime, and the last
    element should specify the least
    preferred version.

    So the way to achieve the second option (“CLR 4 if it is installed, and CLR 2 is CLR 4 is not installed”) is to reverse the order of the elements in app.config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0"/>
            <supportedRuntime version="v2.0.50727"/>
        </startup>
    </configuration>
    

    This way, .NET 4 will be loaded if it is installed, and an earlier version will be loaded if not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a web application that uses SQL Server 2008 as the database. Our
Our application needs to communicate via a H2 database (JDBC) from .Net Framework (WinForms).
Goal : Our application is built using multiple types (e.g. Person, PersonSite(ICollection), Site -
OK, so we're writing our MFC application to make use of the built-in localization
As part of our web application's build process, I have set up our XSLT
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
Our application is built in VB6 and delivered in a SaaS model via Citrix.
I'm working in VS 2010 and working on upgrading our application to .NET 4.
I've got an application that works in our corporate workplace on both Windows XP
Our project has about 20 developers, but our application makes relatively light use of

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.