Difference in Visual Studio Debug and Release and x86, x64, Any CPU's

In Visual Studio Debug and Release of difference:

      In Visual Studio, compile mode there are two kinds: Debug and Release. This is also the default of two ways, in a new project when it already exists these two models to choose from.

      Debug commonly referred debug version, which contain debugging information, and that no optimization, facilitates the programmer debugger.
      Release called the release version, it is often carried out various optimizations such programs on code size and speed is optimal for the user to make good use of.

SO:
      usually come packaged with Release publisher, as Release done more optimized to run faster, suitable for deployment after the completion of the project, in addition, Release packed out of the program files will be relatively smaller. The Debug mode is more suitable for use in development and debugging time. Namely: developing and debugging when using Debug mode, to distribute a program in Release mode.

 

 

Visual Studio, x86, x64, Any CPU differences:

1, simply put, the most immediate difference between them is: x86 platform compiler out of exe (executable file) or dll (dynamic link library) are 32-bit. corresponding to x64 is 64 bit. Any CPU and is dependent on the current operating system, if the operating system is 32 bit, the translation of the program is 32, if the operating system is 64-bit, 64-bit is the compiler program.

2, if you start the project, namely the main program (exe file is compiled) is compiled under x86 platform, but it depends a project (or dynamic link libraries) are compiled from the x64-bit platform, it will Tip error "Could not load file or assembly ... or one of its dependencies. trying to load program with an incorrect format." and the like. This is because the 32-bit 64-bit program can not be loaded dll, but can not call the classes, methods and the like of the objects.
Conversely, if the main program is compiled from the x64 platform, and x86 dll is it? answer. . It is not enough!
Here, basically you can determine that: DLL and main program to generate the same platform as long as you can .
So the question is! If the main program is compiled Any CPU, while the dll is x86 or x64 platform compilation, or the main program is compiled x86 or x64 platform, and dll is compiled by the Any CPU it? The correct answer is both in "exceptional circumstances" are possible. Why are said to be under "special circumstances" mean? Since the first point is also mentioned, Any CPU depending on the operating system, whereas the second binding point just mentioned dll generation platform and the main program is consistent, then also feasible. So, From the result: If the main program is compiled in the Any CPU platform, the compiler dll platforms and operating systems must be consistent with the job of compiling the main program. If the main program is compiled under x86 or x64 platform, the dll must be consistent with the main program. However, there is a special case: If the dll compiled by the Any CPU, then this can be called dll 32-bit and 64-bit main program. Why is this? Look at the third point.

3, although Any CPU compiled by the program depends on the operating system, but the compiler Any CPU out by the dll invoke it depends on the main program, that is, if the main program is 32, then the dll is 32, if the main program 64-bit, then 64-bit dll is. Any compiled dll so commonly used CPU platform, the main program (exe) generally use the x86 platform compiler.

Summary: Learn the difference between them later, when we packed program will know how to choose a. In general, I do not know the customer's computer is a case of what type of operating system, or both, when the main program using x86 platform compiler, dll compiled using Any CPU platform . If clearly know is a 64-bit operating system, then you can press the x64 platform are compiled.

 

Guess you like

Origin www.cnblogs.com/netserver/p/11106130.html