Tuesday, June 28, 2011

Create a setup for Visual Studio project

In Visual Studio 2008,

  1. Go to File > New Project > Project Types: Other Project Types > Set up and Deployment >

  2. Select Setup Wizard

  3. Give a name to setup file and location

  4. Click OK

In Setup Project Wizard,

  1. Select "Create a setup for a Windows application"

  2. Browse for additional files such as config file

  3. If there are any dependancies with the other projects in the same solution, specify that as well

  4. Click Finish
In the Visual Studio build the project,
The setup file will be created in Release/ Debug folder in Setup folder of the project.

You can execute the setup file to start installation. Default installation location will be "C:\Program Files\{Solution name}\.."

To run the executable in Windows command prompt, go to the program files folder and give exe. name with the arguments (if any)
Ex: C:Program Files\Test > Test.exe arg1=1 arg2=2 arg3=3

Thursday, June 23, 2011

Get assembly information - CLR header

In Visual Studio command prompt execute the following command:
corFlags.exe {Assembly name - with file path}

Get assembly information - Meta data version

  1. Run Ildasm.exe command in VisualStudio command prompt. (in VisualStudio tools)

  2. Click File > Open > browse for the assembly in file system > Open

  3. Double click "Manifest"

Check the installed .NET versions in machine

  1. Go to Windows Registry. - Type Regedit in Run prompt
  2. Check the following registry entry:


Capture first chance exceptions

First chance exceptions will not be captured unless you manually set it to throw in Visual Studio.
But the exception type will display as output. (View > Output - ctrl+w O)

How to throw a first chance exception?

Debug > Exceptions > Add... > Type: Common Language Runtime Exceptions > Name: {name of the exception} > OK > Tick the checkbox in Thrown column > OK

Now, once the exception occurs, it will be thrown in run time.