locked
Two different C# compilers with different version numbers? RRS feed

  • Question

  • I've installed VS"15", which I use as a source of command-line tools, rather than as an IDE. Looking around, I find I have two different CSC.EXE C# compilers, in different directories and with different version numbers. 

    One is in "C:\Program Files (x86)\MSBuild\15.0\Bin\csc.exe", and is "Microsoft (R) Visual C# Compiler version 2.0.0.60317" and the other is in "C:\Windows\Microsoft.NET\Framework[64]\v4.0.30319\csc.exe" and is "Microsoft (R) Visual C# Compiler version 4.6.1055.0"

    What's the difference? Why are there two? 

    NB: I do not use MSBuild for anything, because I don't use Visual Studio Projects for anything, at all. I'm strictly a command-line worker, because I work with a programming language that the Visual Studio IDE doesn't understand, which gets compiled into C. I use C# to provide a .NET wrapper for the code I build from this C, but my C# code is not written by hand, but generated by a Perl script, which basically creates a lot of P/Invoke calls. So I'm not especially concerned about access to new language features, but I am concerned about the .NET DLL I produce from this generated code being usable with both C# compilers, if it makes a difference. I have used the one from C:\Windows\Microsoft.NET\Framework[64]\" historically, and if there's no reason to change, I'll carry on doing so. 


    John Dallman

    • Moved by Kristin Xie Thursday, April 14, 2016 5:32 AM
    Tuesday, April 12, 2016 6:18 PM

Answers

  • Hi John Dallman,

    >>"My customers, who usually build with Visual Studio, will thus presumably end up building with MSBuild's CSC.EXE. Is this compatible?"

    Yes, it is. It should be noted that, if you want to use csc.exe to compiler C# code. You should choose the csc.exe file in .NET Framework folder. csc.exe file in MSBuild folder is internal used by MSBuild.

    >>"What's the relationship between the version numbers of MSBuild's CSC and the .NET Framework's CSC? "

    For example, if you want to compiler C# 5.0 code. You should choose the csc.exe in Microsoft.NET\Framework\v4.0.30319. There is a relationship between .NET Framework version and C# version.
    https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Friday, April 22, 2016 9:54 AM
    • Marked as answer by John Dallman Friday, April 22, 2016 9:57 AM
    Friday, April 22, 2016 6:54 AM

All replies

  • Hi John,

    >>What's the difference? Why are there two? 

    c:\Windows\Microsoft.NET\Framework\vX.X.XXX  Should contain the latest 32 bit version of csc.exe

    c:\Windows\Microsoft.NET\Framework64\vX.X.XXX Should contain the lastest 64 bit version of csc.exe

    Usually you want to use the one in C:\WINDOWS\Microsoft.NET\Framework\vx.x.xxxxx\.

    >>One is in "C:\Program Files (x86)\MSBuild\15.0\Bin\csc.exe", and is "Microsoft (R) Visual C# Compiler version 2.0.0.60317" and the other is in "C:\Windows\Microsoft.NET\Framework[64]\v4.0.30319\csc.exe" and is "Microsoft (R) Visual C# Compiler version 4.6.1055.0"

    Starting with Visual Studio 2013, the 2013 version of MSBuild will ship as a part of Visual Studio instead of the .NET Framework. This transition allows us to more rapidly evolve MSBuild. So we can see a separate folder named MSbuild as following, my machine is VS2013 installed.

    C:\Program Files (x86)\MSBuild\12.0\Bin

    Actually, all the versions come from different path are the same, just use the version to distinguish between different .Net framework. 

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Wednesday, April 13, 2016 8:23 AM
    Wednesday, April 13, 2016 8:23 AM
  • Thanks, but I'm still a bit confused. At present, I use CSC.EXE from Framework64 when I'm building .NET code to operate with a 64-bit native library, and the CSC.EXE from Framework when I'm building .NET code to operate with a 32-bit native library. My product is libraries, not an application. My libraries are licensed to other software vendors, who incorporate them into their applications. 

    My customers, who usually build with Visual Studio, will thus presumably end up building with MSBuild's CSC.EXE. Is this compatible? What's the relationship between the version numbers of MSBuild's CSC and the .NET Framework's CSC? 

    I also don't understand this sentence at all:

    > Actually, all the versions come from different path are the same, just use the version to distinguish between different .Net framework. 

    Could you explain in more detail what you mean? 



    John Dallman

    Wednesday, April 13, 2016 11:46 AM
  • Hi John,

    Since this forum is discussing and asking questions about the C# programming language in specific, your case more related to MSBuild CSC.exe versions. I will help move your case to MSBuild forum for better support where you can contact MSbuild experts.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by John Dallman Friday, April 22, 2016 9:56 AM
    • Unmarked as answer by John Dallman Friday, April 22, 2016 9:57 AM
    Thursday, April 14, 2016 5:31 AM
  • Hi John Dallman,

    >>"My customers, who usually build with Visual Studio, will thus presumably end up building with MSBuild's CSC.EXE. Is this compatible?"

    Yes, it is. It should be noted that, if you want to use csc.exe to compiler C# code. You should choose the csc.exe file in .NET Framework folder. csc.exe file in MSBuild folder is internal used by MSBuild.

    >>"What's the relationship between the version numbers of MSBuild's CSC and the .NET Framework's CSC? "

    For example, if you want to compiler C# 5.0 code. You should choose the csc.exe in Microsoft.NET\Framework\v4.0.30319. There is a relationship between .NET Framework version and C# version.
    https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Friday, April 22, 2016 9:54 AM
    • Marked as answer by John Dallman Friday, April 22, 2016 9:57 AM
    Friday, April 22, 2016 6:54 AM
  • Thanks, that's clear. I tried to fill in the survey linked at the bottom of your posting, but the target page doesn't exist. 

    John Dallman

    Friday, April 22, 2016 9:51 AM
  • Hi John,

    >>"I tried to fill in the survey linked at the bottom of your posting, but the target page doesn't exist. "

    Thanks for your feedback. We will try to fix it.

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 22, 2016 9:54 AM