none
How to verify the version of .Net framework the project is using? RRS feed

  • Question

  • I have a .Net based project and not sure which version for framework it is using. What are the ways of finding the version of .Net framework the project is using?
    Tuesday, November 17, 2009 5:17 PM

Answers

  • I guess what pasa meant may be the version which the application was built on.

    If there is any misunderstanding, please correct me, pasa.

    Actually, there is no guaranteed way of determining the exact version the application is built on.
    But we can use some disassembler(such as IL disassembler or .NET Reflector) to detect the version of the assemblies it references.
    mscorlib.dll is the main reference that .NET Framework application must use.

    However, the version of the .NET Framework that an application runs on can be different from the version it's built on, and it is determined as follows:
    • If the version of the .NET Framework that the application was built against is present on the computer, the application runs on that version.

    • If the version of the .NET Framework that the application was built against is not present and a configuration file does not specify a version in a <supportedRuntime> Element , the application runs on the latest version of the .NET Framework that is present on the computer.

    • If the version of the .NET Framework that the application was built against is not present and the configuration file specifies a version in a <supportedRuntime> Element , the application runs on the latest version that is specified in the application configuration file and is present on the computer.

    That means you can Use an Application Configuration File to Target a .NET Framework Version
    Hope it help.

    Thanks.

    Figo Fei

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Figo Fei Monday, November 30, 2009 5:47 AM
    Wednesday, November 18, 2009 4:02 AM

All replies

  • You mean from your code? Environment.Version may be what you need.
    Phil Wilson
    Tuesday, November 17, 2009 7:04 PM
  • I guess what pasa meant may be the version which the application was built on.

    If there is any misunderstanding, please correct me, pasa.

    Actually, there is no guaranteed way of determining the exact version the application is built on.
    But we can use some disassembler(such as IL disassembler or .NET Reflector) to detect the version of the assemblies it references.
    mscorlib.dll is the main reference that .NET Framework application must use.

    However, the version of the .NET Framework that an application runs on can be different from the version it's built on, and it is determined as follows:
    • If the version of the .NET Framework that the application was built against is present on the computer, the application runs on that version.

    • If the version of the .NET Framework that the application was built against is not present and a configuration file does not specify a version in a <supportedRuntime> Element , the application runs on the latest version of the .NET Framework that is present on the computer.

    • If the version of the .NET Framework that the application was built against is not present and the configuration file specifies a version in a <supportedRuntime> Element , the application runs on the latest version that is specified in the application configuration file and is present on the computer.

    That means you can Use an Application Configuration File to Target a .NET Framework Version
    Hope it help.

    Thanks.

    Figo Fei

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Figo Fei Monday, November 30, 2009 5:47 AM
    Wednesday, November 18, 2009 4:02 AM
  • If the project opens in VS 2008, is the project using .Net 3.5 framework? By looking into which config file in project, I can determine the version of .Net framework the project is using?
    Thursday, November 19, 2009 4:14 PM
  • Hi pasa

    As VS2008 can open the project, that means the project file has been created or converted to VS2008 type.
    And VS2008 has the multi-targeting feature, it can make the project targeting on .NET 2.0/3.0/3.5.

    Config file gives us an option to target on a version of .NET framework, but not the way to tell what it was built agaist.

    Hope it is clearer.

    Thanks.

    Figo Fei

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, November 20, 2009 2:56 AM