Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Multi-version compilation [modified]

Multi-version compilation [modified]

Scheduled Pinned Locked Moved C#
csharpdotnetvisual-studioquestionannouncement
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joputaidilico
    wrote on last edited by
    #1

    Hi, as all we know there are at least 4 different versions of .NET framework. is there any internal IDE constant, that defines wich version of the framework is expected the IDE to build for? Motivation: It's very common having various versions of the framework living in the same machine. The IDE seems to build compatible binaries with the newest framework installed on system, thus coppying the sources on another machine, makes impossible to compile the code, without, changing lots of lines of code.. COMMON valid compatible CODE #if NETFW_VERSION_1_1 1 valid code for 1.1 #else #if NETFW_VERSION 2_0 valid code for 2.0 #endif COMMON valid compatible CODE -- modified at 11:43 Monday 5th March, 2007

    B E L 3 Replies Last reply
    0
    • J joputaidilico

      Hi, as all we know there are at least 4 different versions of .NET framework. is there any internal IDE constant, that defines wich version of the framework is expected the IDE to build for? Motivation: It's very common having various versions of the framework living in the same machine. The IDE seems to build compatible binaries with the newest framework installed on system, thus coppying the sources on another machine, makes impossible to compile the code, without, changing lots of lines of code.. COMMON valid compatible CODE #if NETFW_VERSION_1_1 1 valid code for 1.1 #else #if NETFW_VERSION 2_0 valid code for 2.0 #endif COMMON valid compatible CODE -- modified at 11:43 Monday 5th March, 2007

      B Offline
      B Offline
      BrianShields
      wrote on last edited by
      #2

      You're looking for '__CLR_VER' - check http://msdn2.microsoft.com/en-us/library/b0084kay.aspx. I don't believe you can change the framework you're linking to without switching compilers though.

      J 1 Reply Last reply
      0
      • B BrianShields

        You're looking for '__CLR_VER' - check http://msdn2.microsoft.com/en-us/library/b0084kay.aspx. I don't believe you can change the framework you're linking to without switching compilers though.

        J Offline
        J Offline
        joputaidilico
        wrote on last edited by
        #3

        yes! that's perfect, but seems that constant is not yet defined inside a C# or VB.net project. Is there something similar when using c# or VB.net?

        D 1 Reply Last reply
        0
        • J joputaidilico

          Hi, as all we know there are at least 4 different versions of .NET framework. is there any internal IDE constant, that defines wich version of the framework is expected the IDE to build for? Motivation: It's very common having various versions of the framework living in the same machine. The IDE seems to build compatible binaries with the newest framework installed on system, thus coppying the sources on another machine, makes impossible to compile the code, without, changing lots of lines of code.. COMMON valid compatible CODE #if NETFW_VERSION_1_1 1 valid code for 1.1 #else #if NETFW_VERSION 2_0 valid code for 2.0 #endif COMMON valid compatible CODE -- modified at 11:43 Monday 5th March, 2007

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          Wrong forum  ;)

          1 Reply Last reply
          0
          • J joputaidilico

            yes! that's perfect, but seems that constant is not yet defined inside a C# or VB.net project. Is there something similar when using c# or VB.net?

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            First, you're in the wrong forum for asking questions. Second, no there is no constant in C# or VB.NET that defines which version of Visual Studio and hence which version of the .NET Framework your compiling against. You can NOT switch compilers in Visual Studio. The IDE is very dependant on a specific version in order to work. If you want to switch the compilers, you'll have to compile your application entirely from the command line, specifying fully qualified paths to which version of the .NET Framework you want to use to compile your app.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            1 Reply Last reply
            0
            • J joputaidilico

              Hi, as all we know there are at least 4 different versions of .NET framework. is there any internal IDE constant, that defines wich version of the framework is expected the IDE to build for? Motivation: It's very common having various versions of the framework living in the same machine. The IDE seems to build compatible binaries with the newest framework installed on system, thus coppying the sources on another machine, makes impossible to compile the code, without, changing lots of lines of code.. COMMON valid compatible CODE #if NETFW_VERSION_1_1 1 valid code for 1.1 #else #if NETFW_VERSION 2_0 valid code for 2.0 #endif COMMON valid compatible CODE -- modified at 11:43 Monday 5th March, 2007

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Hi, I have isolated the relevant differences between 1.1 and 2.0 and have put them in separate classes, so when class XXX changes in a way that is relevant to me, I create class LP_XXX and give it appropriate behavior; its implementation is based on the symbols NET11 and NET20, one of which is always defined in my Visual projects, depending on which Visual Studio version I use. And yes I would have liked such symbols to exist automatically. :)

              Luc Pattyn [My Articles]

              J 1 Reply Last reply
              0
              • L Luc Pattyn

                Hi, I have isolated the relevant differences between 1.1 and 2.0 and have put them in separate classes, so when class XXX changes in a way that is relevant to me, I create class LP_XXX and give it appropriate behavior; its implementation is based on the symbols NET11 and NET20, one of which is always defined in my Visual projects, depending on which Visual Studio version I use. And yes I would have liked such symbols to exist automatically. :)

                Luc Pattyn [My Articles]

                J Offline
                J Offline
                joputaidilico
                wrote on last edited by
                #7

                Yes! thanks Luc! That's the solution I've adopted here: manually! In real world: Microsoft releases different version of the FrameWork at will. Customers has diferent versions of Framework installed. Our enterprise has 2 compiling machines, one for each framework, each with his own VS IDE We want to maintain just 1 source at a time So... what the F*)%!=) is missing an IDE constant telling us wich version of the framework is installed with the IDE, and thus making and automatic compilation.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups