What csc.exe version should I use 32-bit or 64-bit?

Abdulqadir Aliyev 136 Reputation points
2022-12-26T17:37:28.64+00:00

Hello. I got a huge C# code, and I want to compile it to a EXE or DLL using CSC. Microsoft did already tell me how to do that, however, just before I run that csc.exe command to compile my C# code to an EXE, I need to know if I need to use a 32-bit version (C:\Windows\Microsoft.NET\Framework), or 64-bit version (C:\Windows\Microsoft.NET\Framework64), and I am having a massive headache with this.

So which csc.exe version should I use? From C:\Windows\Microsoft.NET\Framework64 (64-bit), or C:\Windows\Microsoft.NET\Framework (32-bit)? And what are the differences anyway?

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Ali AlEnezi 1,081 Reputation points
    2022-12-26T17:39:03.623+00:00

    Hello,

    To determine which version of csc.exe you should use to compile your C# code, you need to consider the following factors:

    1. The platform you are targeting: If you are targeting a platform that is compatible with 64-bit applications, such as a 64-bit version of Windows, you should use the 64-bit version of csc.exe. If you are targeting a platform that is compatible with 32-bit applications, such as a 32-bit version of Windows, you should use the 32-bit version of csc.exe.=
    2. The capabilities of your development environment: If you are using a development environment that is capable of compiling both 32-bit and 64-bit applications, you can use either version of csc.exe. However, if your development environment is limited to compiling only 32-bit or only 64-bit applications, you will need to use the appropriate version of csc.exe.
    3. The size of your code: In general, 64-bit applications can access more memory than 32-bit applications, so if your C# code is very large and may need to access more than 4 GB of memory, you may want to consider using the 64-bit version of csc.exe.

    Good luck!

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 81,696 Reputation points Volunteer Moderator
    2022-12-26T17:54:34.063+00:00

    If you are using the command line, then use the version that matches the bitness of the hosting o/s (actually a 32 bit o/s can not run the 64 bit version) While you can run the 32 bit version on a 64 bit o/s, you will get better performance from the 64 bit version.

    Both versions can target 32 bit or 64 bit.

    But not sure why you are using the old compilers rather than the Roslyn compilers.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.