Tuesday, February 13, 2007

Installing Your Program - Part 2 - Installing Your Files

Step 2 of the install process is nice and easy - no command-prompt needed :)

Create a new project (add it to the existing solution) in Visual Studio. Under 'Other Projects', you'll find "Setup and Deployment". This will allow you to create an installer.

Give your program a name like <program name>Setup - try to steer clear of generic names like 'setup', simply because it's very easy to get your 'setup.msi' confused with hundreds of others with exactly the same name.

Now your new project should appear in the Solution Explorer. Click it, and go to the 'View' menu. Under 'View', you should now have the 'Editor' submenu. This allows you to choose to edit the various parts of your installation - the files, registry settings etc.

Choose 'File System', if it isn't selected already.

The first entry will read 'File System on Target Machine'. Right-click this line and a popup menu will appear. Choose 'Add Special Folder|Global Assembly Cache Folder' to add the GAC to your installer.

Right click on the new folder that will appear and choose 'Add|Project Output...' from the popup menu. You can then 'Primary Output' from the list of different types of file you can include from your project.

This will add your .NET classes into the Global Assembly Cache, as well as get a reference to a number of extra DLL's and modules that your application will require. If you check the solution explorer, you'll notice that Microsoft.MediaCenter.dll and a couple of it's friends will have appeared.

We don't need to install these, although they ARE required for your program to work correctly. To avoid installing these (which would be illegal), we right click on the files and choose 'Exclude'.

There! Your .NET files are now installing. The next thing we need to do is tell Media Center where our program is, what it does and what it's called. That's covered in the next post...

No comments: