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. .NET (Core and Framework)
  4. Relationship of C# Version to .NET Version

Relationship of C# Version to .NET Version

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpasp-netdotnetquestionannouncement
12 Posts 7 Posters 1 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.
  • P Offline
    P Offline
    Patrick Skelton
    wrote on last edited by
    #1

    Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

    M G S L 5 Replies Last reply
    0
    • P Patrick Skelton

      Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

      M Offline
      M Offline
      Michel Godfroid
      wrote on last edited by
      #2

      Tricky to answer that one. In principle, C# is just a compiler, which compiles code to the CIL (or MSIL). Now MSIL has not changed greatly since standardisation (I don't even think it has changed), so things look bright there. The problems are that: C# is not a pure compiler. For some language features (for example it's basic object implementation), it relies on the CLR to supply the implementation. So constructs which are added to the language may well rely on specific features of the libraries. Also when compiling code (which happens in asp.net pages), the compilation will rely on System.CodeDom.Compiler to emit the MSIL. Since System.CodeDom.compiler is part of the CLR, you could say that there is a dependency on the libraries ( I'm pretty sure that when you compile through the C# compiler, the compiler relies on the CLR to emit it's bytecode, and will choose the adequate version of the CLR for it's task. SO: I'm not sure, this is educated guesswork. Haven't found anything on this subject really. Anybody can offer some more insight? Pity that Brad Abrams has just left Microsoft, he would have been the person to ask... He's the father of .Net. http://blogs.msdn.com/brada/default.aspx[^]

      1 Reply Last reply
      0
      • P Patrick Skelton

        Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

        G Offline
        G Offline
        Gregory Gadow
        wrote on last edited by
        #3

        Technically, there are no different versions of C#; there are only different versions of the framework, which instruct the IDE, compiler, linker and other tools as to what is correct and what is not. If you use the 4.0 framework, then you are automatically using C# 4.0; if you use the 1.1 framework, then you are using C# 1.1. Because of this, there is no minimum version of the framework, there is only the version needed by your application. If you compile your app to the 4.0 framework, your user will need to have the 4.0 framework. This is because the code does not reference System.Core, it references System.Core version 4.0.0.0 public key token whatever. If that assembly is not found, your user will not be able to run the app. Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

        T 1 Reply Last reply
        0
        • P Patrick Skelton

          Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

          S Offline
          S Offline
          Scott Dorman
          wrote on last edited by
          #4

          This information is more difficult to find than it should be. Here is a breakdown which shows how Visual Studio, CLR, and .NET Framework versions relate to each other:

          Visual Studio CLR .NET Framework

          Visual Studio .NET (Ranier) 1.0.3705 1.0
          Visual Studio 2003 (Everett) 1.1.4322 1.1
          Visual Studio 2005 (Whidbey) 2.0.50727 2.0
          Visual Studio 2005 with .NET 3.0 Extensions 2.0.50727 2.0, 3.0
          Visual Studio 2008 (Orcas) 2.0.50727 2.0 SP1, 3.0 SP1, 3.5
          Visual Studio 2008 SP1 2.0.50727 2.0 SP2, 3.0 SP2, 3.5 SP1
          Visual Studio 2010 (Hawaii) 4.0.30319 4.0

          As for how C# relates to all of this, the breakdown is:

          C# CLR .NET Framework

          1.0 1.0.3705 1.0
          1.1 1.1.4322 1.1
          2.0 2.050727 2.0, 2.0 SP1, 3.0, 3.0 SP1
          3.0 2.050727 2.0 SP2, 3.0 SP2, 3.5, S.5 SP1
          4.0 4.0.30319 4.0

          Corrected the information for C# 3.0.

          Scott Dorman

          Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


          Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

          modified on Sunday, April 25, 2010 9:02 AM

          P 1 Reply Last reply
          0
          • P Patrick Skelton

            Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            In following link "John W Powell" describes the differences of .net versions and C# versions with features added into newer versions clearly. http://blogs.msdn.com/johnwpowell/archive/2008/03/16/c-and-net-framework-features-by-version-quick-reference.aspx[^]

            Jinal Desai

            1 Reply Last reply
            0
            • S Scott Dorman

              This information is more difficult to find than it should be. Here is a breakdown which shows how Visual Studio, CLR, and .NET Framework versions relate to each other:

              Visual Studio CLR .NET Framework

              Visual Studio .NET (Ranier) 1.0.3705 1.0
              Visual Studio 2003 (Everett) 1.1.4322 1.1
              Visual Studio 2005 (Whidbey) 2.0.50727 2.0
              Visual Studio 2005 with .NET 3.0 Extensions 2.0.50727 2.0, 3.0
              Visual Studio 2008 (Orcas) 2.0.50727 2.0 SP1, 3.0 SP1, 3.5
              Visual Studio 2008 SP1 2.0.50727 2.0 SP2, 3.0 SP2, 3.5 SP1
              Visual Studio 2010 (Hawaii) 4.0.30319 4.0

              As for how C# relates to all of this, the breakdown is:

              C# CLR .NET Framework

              1.0 1.0.3705 1.0
              1.1 1.1.4322 1.1
              2.0 2.050727 2.0, 2.0 SP1, 3.0, 3.0 SP1
              3.0 2.050727 2.0 SP2, 3.0 SP2, 3.5, S.5 SP1
              4.0 4.0.30319 4.0

              Corrected the information for C# 3.0.

              Scott Dorman

              Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


              Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

              modified on Sunday, April 25, 2010 9:02 AM

              P Offline
              P Offline
              Patrick Skelton
              wrote on last edited by
              #6

              Thanks for all these replies. I expected a nice one-line answer, but clearly it is all a lot more complicated than that. I am going to print out this table. I know Visual Studio largely worries about everything for you, but as a veteran C++ programmer, I do like to know what versions of code are running (or failing to run) with each other. Thanks for all the help. Best wishes, Patrick

              1 Reply Last reply
              0
              • G Gregory Gadow

                Technically, there are no different versions of C#; there are only different versions of the framework, which instruct the IDE, compiler, linker and other tools as to what is correct and what is not. If you use the 4.0 framework, then you are automatically using C# 4.0; if you use the 1.1 framework, then you are using C# 1.1. Because of this, there is no minimum version of the framework, there is only the version needed by your application. If you compile your app to the 4.0 framework, your user will need to have the 4.0 framework. This is because the code does not reference System.Core, it references System.Core version 4.0.0.0 public key token whatever. If that assembly is not found, your user will not be able to run the app. Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

                T Offline
                T Offline
                The Man from U N C L E
                wrote on last edited by
                #7

                Gregory.Gadow wrote:

                Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

                Not entirely true. .Net framework 3.5 and 4.0 are technically extensions of the 2.0 Framework, though dependant on enhancements made in service pack 1 of 2.0. Therefore anyone with 3.5 or 4.0 installed DOES have 2.0 installed, so 2.0 apps will continue to work fine. However you you will have to build against service pack 1 which only comes as part of the 3.5 and 4.0 bundles. It is not available separately, so you may as well build against the later frameworks even if you do not use their functionality. 3.5 to 4.0 is I believe a breaking change, and likewise 1.0 to 1.1 to 2.0. As far as I am aware only the 2.0 Framework has persisted upstream.

                If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

                G G P 3 Replies Last reply
                0
                • T The Man from U N C L E

                  Gregory.Gadow wrote:

                  Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

                  Not entirely true. .Net framework 3.5 and 4.0 are technically extensions of the 2.0 Framework, though dependant on enhancements made in service pack 1 of 2.0. Therefore anyone with 3.5 or 4.0 installed DOES have 2.0 installed, so 2.0 apps will continue to work fine. However you you will have to build against service pack 1 which only comes as part of the 3.5 and 4.0 bundles. It is not available separately, so you may as well build against the later frameworks even if you do not use their functionality. 3.5 to 4.0 is I believe a breaking change, and likewise 1.0 to 1.1 to 2.0. As far as I am aware only the 2.0 Framework has persisted upstream.

                  If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

                  G Offline
                  G Offline
                  Gideon Engelberth
                  wrote on last edited by
                  #8

                  3.0 and 3.5 were additive releases to the 2.0 framework that also included some service packs to 2.0. However, The 4.0 framework is a completely different version than the 2.0 framework. Just having the 4.0 framework does not imply that the 2.0 framework is present.

                  1 Reply Last reply
                  0
                  • P Patrick Skelton

                    Hi, I am having real trouble finding an article which explains what the relationship is between the various versions of C# and the .NET (and ASP.NET) libraries. I want to be able to answer questions such as: if you want to use, say, C# 4.0, does that tie you to a minimum version of .NET (and the CLR)? Any pointers would be very much appreciated. Best wishes, Patrick

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    In addition to what other people said.. You can use C# 3 with .NET 2.0 with some restrictions. For example, to make extension methods work you need to add the following code:

                    namespace System.Runtime.CompilerServices
                    {
                    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
                    public sealed class ExtensionAttribute : Attribute
                    {
                    public ExtensionAttribute() { }
                    }
                    }

                    The attribute does nothing, it's used internally by the compiler to mark extension methods.

                    1 Reply Last reply
                    0
                    • T The Man from U N C L E

                      Gregory.Gadow wrote:

                      Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

                      Not entirely true. .Net framework 3.5 and 4.0 are technically extensions of the 2.0 Framework, though dependant on enhancements made in service pack 1 of 2.0. Therefore anyone with 3.5 or 4.0 installed DOES have 2.0 installed, so 2.0 apps will continue to work fine. However you you will have to build against service pack 1 which only comes as part of the 3.5 and 4.0 bundles. It is not available separately, so you may as well build against the later frameworks even if you do not use their functionality. 3.5 to 4.0 is I believe a breaking change, and likewise 1.0 to 1.1 to 2.0. As far as I am aware only the 2.0 Framework has persisted upstream.

                      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

                      G Offline
                      G Offline
                      Gregory Gadow
                      wrote on last edited by
                      #10

                      Thanks for the clarification :thumbsup:

                      1 Reply Last reply
                      0
                      • T The Man from U N C L E

                        Gregory.Gadow wrote:

                        Likewise, you cannot compile your app to the 2.0 framework and expect it to work if the user has only 3.5 or 4.0.

                        Not entirely true. .Net framework 3.5 and 4.0 are technically extensions of the 2.0 Framework, though dependant on enhancements made in service pack 1 of 2.0. Therefore anyone with 3.5 or 4.0 installed DOES have 2.0 installed, so 2.0 apps will continue to work fine. However you you will have to build against service pack 1 which only comes as part of the 3.5 and 4.0 bundles. It is not available separately, so you may as well build against the later frameworks even if you do not use their functionality. 3.5 to 4.0 is I believe a breaking change, and likewise 1.0 to 1.1 to 2.0. As far as I am aware only the 2.0 Framework has persisted upstream.

                        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

                        P Offline
                        P Offline
                        Patrick Skelton
                        wrote on last edited by
                        #11

                        My god - could this BE any more complicated. I thought .NET was supposed to cure the old 'DLL hell'; seems to have replaced one set of problems with another. Does anyone know if you can get an installer (or something) that will simplify the process of getting the right version of .NET for an application? Over the years, I have always found myself having a negative reaction to many Java applications because they just never seemed to work (though this does seem to have improved somewhat recently). The reason could have been bad coding, but I got the feeling a lot of it may have been due to having the wrong framework installed. If I were trying out a .NET application and I got a runtime exception saying the right version of the framework was missing, I'd be that much more likely to ditch the app - especially if it were just something small that I was evaluating. I guess the point I am really making here is that all this version stuff needs to be something the end-user just doesn't have to worry about or .NET and I as the developer are failing them in a big way and they will simply go back to that old C++ .exe they know and trust. -Patrick :~

                        P 1 Reply Last reply
                        0
                        • P Patrick Skelton

                          My god - could this BE any more complicated. I thought .NET was supposed to cure the old 'DLL hell'; seems to have replaced one set of problems with another. Does anyone know if you can get an installer (or something) that will simplify the process of getting the right version of .NET for an application? Over the years, I have always found myself having a negative reaction to many Java applications because they just never seemed to work (though this does seem to have improved somewhat recently). The reason could have been bad coding, but I got the feeling a lot of it may have been due to having the wrong framework installed. If I were trying out a .NET application and I got a runtime exception saying the right version of the framework was missing, I'd be that much more likely to ditch the app - especially if it were just something small that I was evaluating. I guess the point I am really making here is that all this version stuff needs to be something the end-user just doesn't have to worry about or .NET and I as the developer are failing them in a big way and they will simply go back to that old C++ .exe they know and trust. -Patrick :~

                          P Offline
                          P Offline
                          Patrick Skelton
                          wrote on last edited by
                          #12

                          Actually, scratch the question in my last post. Following the link posted by Jinal, it looks like I need to investigate 'Click Once' deployment maybe. -Patrick PS - My first ever program was a plot of X-squared on a ZX81 in BASIC (which crashed because of lack of screen memory after plotting the fourth block); stuff is just too big and complicated for me these days. Maybe I need a new job - pushing trolleys at ASDA maybe.

                          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