Friday, June 11, 2010

How Platform target: switch works?

Platform Target
Platform target switch is used to generate assemblies for 32 bit, 64 bit or for both (that can be used on 32 as well as 64 bit machine)

Switch:
x86: Generate assemblies for 32 bit platform.
x64: Generate assemblies for 64 bit platform.
Any CPU : Generate assemblies for 32 bit as well as 64 bit platform.

Example:
Lets suppose I have some exe's and dll's generated using these switches.

EXE                                 DLL                                       Switch
Myx86.exe                       Myx86.dll                                - x86
Myx64.exe                       Myx64.dll                                - x64
MyAnyCPU.exe               MyAnyCPU.dll                       - Any CPU

Running exe on 32 bit machine:

Myx86.exe will act as 32 bit application and can refer Myx86.dll and MyAnyCPU.dll but will give exception for Myx64.dll

Myx64.exe will give an exception.

MyAnyCPU.exe will act as 32 bit application and can refer Myx86.dll and MyAnyCPU.dll but will give exception for Myx64.dll

Running exe on 64 bit machine:

Myx86.exe will will act as 32 bit application and can refer Myx86.dll and MyAnyCPU.dll but will give exception for Myx64.dll

Myx64.exe will act as 64 bit application and can refer Myx64.dll and MyAnyCPU.dll but will give exception for Myx86.dll

MyAnyCPU.exe will act as 64 bit application and can refer Myx64.dll and MyAnyCPU.dll but will give exception for Myx86.dll

Thursday, June 10, 2010

Window Form Event Order

Application Startup Events

Control.HandleCreated

Control.BindingContextChanged

Form.Load

Control.VisibleChanged

Form.Activated

Form.Shown

Application Shutdown Events

Form.Closing

Form.FormClosing

Form.Closed

Form.FormClosed

Form.Deactivate