When we are writing .NET applications and need to go live we need to prepare our app to be deployed properly. We have in .NET Framework several deployment strategies to help developer make a really soft and clean deploy and each strategy address a particular deployment scenario. For example, for corporate scenarios ClickOnce deployment is the best choice but for ISV that writes custom apps Visual Studio Setup Project is the perfect fit.
I don’t pretend to write about each deployment strategy because there is a lot if info about it out there in MSDN and blogs. What I want to do is to explain several aspects that we need to consider when we are doing deployment for .NET 3.0 apps.
Every developer that need to deploy .NET 3.0 apps from my perspective first need to read carefully the Microsoft .NET Framework 3.0 Deployment Guide. And of course follow the instructions but you will find in the section called “Redistributing .NET Framework 3.0 Using a Visual Studio 2005 Setup Project” several error messages when trying to compile and build your setup project with the “Prerequisites” feature enable and the “download prerequisites from the same location as my application” option selected.
Basically when you select the project properties and hit the prerequisites button you will find a list of installer components that are software prerequisite for your app. And we can deploy this prerequisites In the same installer if we select the download prerequisites from the same location as my application option.
If we select to include .NET Framework 3.0 as a prerequisite and compile your setup project you will find the following errors:
This is ease to fix. The problem describes that in order to compile our setup project and include the prerequisites definition and files for the .NET Framework 3.0 we need to have located in our local disk the correspondent re distribuible files. So the problem is that we don’t have the .NET Framework 3.0 installers in a special folder that Visual Studio use for copying to the setup project.
Go to C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\NETFX30 folder and you will find the following structure:
The installer will search the .NET Framework 3.0 msi files and make a copy to your setup project but the problem is that we don’t have those files and that’s the reason we have the previous error messages. And also will select from the product.xml file all the custom conditions and installer requirement we need. By default we use the “en” folder, will find another xml file called package.xml. This file contains the url address for getting the installer from the Microsoft download center.
Now compile your setup project, the error messages goes away and you will find the following folder structure in you debug folder:
This means that you have a copy of the .NET Framewok 2.0 and 3.0 installers inside your deployment output. The setup file will launch the prerequisites installer before the your app will install.
That’s it, hope it helps.