A few years ago I was writing code for a museum exhibit using 3D technology in Microsoft XNA and .NET. We installed the computer with the software already on it, so I never learned how to package code for distribution over the Internet. I decided to take a look at this in more detail.
How I Think It Works Now
In the olden days, you’d compile .COM and .EXE files, which would be loaded by DOS or Windows into memory. They could link to external library files called DLLs, which the app was responsible for finding and loading. There were also other Windows runtime components like COM objects that use a different dispatching mechanism. I have no idea how it really works. I suspect there is just a different loading mechanism that isn’t based on knowing a directory path.
Applications written for Microsoft’s .NET platform, by comparison, run on a managed bytecode interpreter (the Common Language Runtime, or CLR) that has an extensive class library. The entire Framework Class Library (FCL) is comparable to what’s available for Java. Like Java, applications written for .NET deploy in a new kind of executable format…or is it?
Anyway, installing a Windows App meant doing a few things:
- Copying the files to some place in the Program Files Directory
- Adding or Modifying Registry Settings
- Setting Paths
- Creating Shortcuts on the Desktop and Entries in the Start Menu
- Registering File Types
- Adding Explorer Context Menu actions
- Installing Dependencies
I’ve been confused by the process before because of these things called “Manifests” and “Assemblies”. I believe manifests are related to security.
Conceptually, to deploy a desktop app I need to either use Windows Installer (which means learning how it works) or make it a “Click Once” application that is installed from a file or web server. I have no idea how that works. It sounds cool, though it doesn’t have all the features (I read) of Windows Installer. Furthermore, I may need to actually INSTALL the framework if it’s not already on the computer. Major PITA.
So…WTF do you do? Is there one concise guide somewhere? Doing the usual searches for keywords reveals the typically dense and unfocused Microsoft documentation.
First of all, why is it so hard? Maybe it isn’t…maybe there is something built-into VS2010 now that does it. Ah, yes, there is a kind of project you can add to your solution called a setup project
Visual Studio 2010 Instructions
I can add a new project to the solution, under “Other Project Types -> Setup and Deployment -> Visual Studio Installer”. For a App deployed from an installer file, use a Setup Project. There are a couple of Wizards too. I’ll tryt the Setup Wizard to see how it prompts me.
First it asks me if I want to create a setup for a Windows app, or a setup for a web application. Other choices: create a redistributable package as a “merge module” for Windows Installer, or a downloadable CAB file. I guess I’ll go for “merge module”. I can choose one of these four.
Next, I’m prompted for which “project output groups” to include. These are:
- localized resources (?) from ProductivityApp
- XML Serialization Assemblies
- COntent Files
- Primary output
- Source Files
- Debug Symbols
- Documentation Files
There’s reference here to “Satellite assemblies” for “each culture’s resources”. WTF? Damn it, Microsoft. Where is your help file?
THere is at least a description…the “Primary Output” is the DLL or EXE that’s built. I suppose “Content Files” are other directories I could have added to the app. I’ll just choose primary output for now.
Next, I can choose additional files to include, then clicked FINISH.
The resulting screen I see shows a number of different file systems on the target machine, and I can apparently chose what goes where.
I don’t know what to do, so I chose “Build Installer” from the Build Menu to see what it did. It created an installer in the InstallerDebug directory.
I also see that under Installer Properties, there’s a Prerequisites tab which allows me to create “setup program” to install prequisite components, such as .NET 4. How do I add XNA or DirectX, I wonder? This says that it should be invoked as a “custom action”. ANd here’s another description of including the installer along with other links.
ANYWAY
Running the installer…Oh, the name of the project I made, Installer, is the name of the application! Renaming it didn’t help. However, there is a “properties” window where I think I can change the name, and other properties. Yes, this seemed to work.
Trying the installer now…says the publisher is unknown. I guess I need to get a key of some kind. Also, the program is created in Program Files (x86) under the manufacturer name (David Seah) and then the name of the program (Productivity App). I note there is also no icon.
But it runs! I can add shortcut to desktop too. This is not so bad. I am also seeing it in control panel application, so I can remove it. Yay! Awesomeness!
0 Comments