Welcome to UltiDev Cassini Web Server for ASP.NET
distribution walkthrough. This document explains how to
create a Visual Studio 2005 solution that will
include an ASP.NET 2.0 application project and a Setup
project for installing the application along with UltiDev
Cassini Web Server on a target machine.
Similar steps could be taken in Visual Studio 2008
to create an installer for an ASP.NET 3.x or 2.0
application.
The process of creating a setup project for an
ASP.NET 1.1 application is slightly different and is
described in the
corresponding
article.
Conceptually, creating a redistributable package
for an ASP.NET 2.0 application including UltiDev Cassini
consists of the following steps:
- Create a regular, non-web, setup project and add it to
the solution that has ASP.NET application; - Add UltiDev Cassini Web Server as a Pre-Requisite to
the setup project - to include the reference to UltiDev
Cassini components into the Setup.exe bootstrapper
generated by Visual Studio 2005.
- Add custom actions to the setup project that register
the ASP.NET application with Cassini after installation
and unregister during uninstallation;
This will create a distribution package that will
ensure that the latest version of UltiDev Cassini Web
server is deployed and started on the target machine
before your application is installed.
This walkthrough assumes that UltiDev Cassini Web
Server for Visual Studio 2005 Developers installed and
that you have an existing
solution with an ASP.NET application opened in a
non-Express edition of the Visual Studio 2005 IDE. In the end you will have a project
closely resembling the
sample
project we provided for Visual Studio 2005.
First thing to do is to add a new setup project to your
existing ASP.NET web application solution. Please select
File | Add | New Project menu item and add a new
regular Setup project to the solution:

- Ensure that your setup is going to be built. For that
right-click the solution item and select Configuration
Manager. There check the "Build" checkbox for your setup
project for at least Release build configuration.
- Add UltiDev Cassini Web Server 2.0 Pre-Requisite to
the setup project. To do that right-click setup project
item in the solution tree and select Properties menu
item. In the popped-up dialog click Prerequisites
button:

Check ".NET Framework 2.0" (3.5 for ASP.NET
3.x projects), "Windows installer 3.1" and
"UltiDev Cassini Web Server for ASP.NET 2.0"
prerequisites:

Depending on whether you are going to distribute your
application via web or ship it on a CD, select an
appropriate radio-button in the "Specify the install
location for prerequisites" section. This will generate Setup.exe bootstrapper with the built-in knowledge of
where to find Cassini in case it's not present on
customer's box. -
Next, Add your application files to the setup project.


- Add UltiDevCassiniServerConfiguration.dll file to the Setup project.
UltiDevCassiniServerConfiguration.dll assembly is a part of UltiDev
Cassini package and contains custom installer class
that can be invoked from a Setup project to register or
un-register an ASP.NET application with UltiDev Cassini.
To add UltiDevCassiniServerConfiguration.dll to your Setup project,
using Setup project's File System View, create Bin
folder under the Application Folder:

Then right-click on Bin folder and select Add | Assembly...
In the Open File dialog navigate to UltiDev Cassini
folder, which is usually "C:\Program
Files\UltiDev\Cassini Web Server for Visual Studio 2005
Developers" (in older versions it could be
"C:\Program Files\UltiDev\Cassini Web Server for ASP.NET
2.0")

... and pick UltiDevCassiniServerConfiguration.dll.
UltiDevCassiniServerConfiguration.dll contains routines
that register and unregister ASP.NET applications with
UltiDev Cassini.
After you have added UltiDevCassiniServerConfiguration.dll, your
Setup project will look like this:
- Next step is to hookup installer class located in
UltiDevCassiniServerConfiguration to your setup
project's custom installer actions, which will register
and unregister your ASP.NET application with Cassini
during installation and uninstallation.
Start with creating Install, Rollback and Uninstall
custom actions in the Setup project, pointing to the UltiDevCassiniServerConfiguration.dll
you've just added. To do that switch to the Custom
Actions View of the Setup project and right-click on
Install, Rollback and Uninstall actions and select Add
Custom Action menu. In the Select Item dialog
navigate to the Application Folder\Bin folder and select UltiDevCassiniServerConfiguration.dll for each custom action:

The result will look like this:

At this point you hooked up Cassini's installer
class to setup project's custom installer
actions. Now you just need to pass application's registration information to the Cassini
Configuration module.
"Install" action requires several parameters, while
Rollback and Uninstall steps require only one parameter
- application ID. Application ID should be a unique
GUID. You can either generate a new GUID using MS Guidegen.exe utility, or better, just reuse an
UpgradeCode of your setup project. To get UpgradeCode
value of your setup project, bring up Setup project's
properties:

... and copy & paste the GUID
value in the Notepad for the use further in this
walkthrough.
To specify application ID for Rollback action, select
UltiDevCassiniServerConfiguration.dll under Rollback bin and set
CustomActionData property value to /AppID="<your
application ID>":
 Then repeat the same for the Uninstall action.
CustomActionData values for Rollback and Uninstall steps
should be identical.
"Install" action has following parameters passed via
CustomActionData property:
| Parameter |
|
Meaning |
Example |
|
/AppID |
Required |
Application ID |
/AppID="{61526CD1-BBBE-4511-902D-EFE4A1E2845F}" |
| /AppLocation |
Required |
Physical
location of the application. Should always be set to
"[TARGETDIR]\". |
/AppLocation="[TARGETDIR]\" |
| /AppName |
Optional |
Application
Name |
/AppName="Test Cassini 2.0 Setup App" |
| /AppDescription |
Optional |
Application
Description |
/AppDescription="some useful text" |
|
/AppPort |
Optional |
Application
Port |
/AppPort="80" |
Don't specify the port explicitly if possible! Cassini
Explorer can redirect user's browser to the correct application URL by
application ID if you point the browser to
http://<macchinename>:7756/GoToApplication.aspx?AppID=<your
application ID>.
Web service clients can too call
Cassini Explorer web service at
http://<machinename>:7756/CassiniConfigurationService.asmx
to get your application's URL. |
| /AppDefaultDoc |
Optional if
default document is Default.aspx or
Index.htm |
Default
application document |
/AppDefaultDoc="WebForm1.aspx" |
|
/AppKeepRunning |
Optional |
Flag telling if
application should always be kept in memory for
quick first-page response. Default value is true. |
/AppKeepRunning="false" |
Here's the example of the Install action's
CustomActionData value:

At this point you can test
the installation by running Setup.exe.
From this point forward the information
in this document
is not really related to application + Cassini
installation, but rather just a general helpful tip for
your non-IIS web application setup...
-
If you want to add a Programs menu shortcut to your application, please do the
following.
Add an text file to your ASP.NET application project and save with the ".url"
extension. The name of the file will be the text
displayed by Programs menu, it should reflect the name
of your application.

Open the file in text editor and
replace its content with the following:
[InternetShortcut]
URL=http://localhost:7756/GoToApplication.aspx?AppID=87C97D89-B993-411D-A0EF-782191F1DBDD
Replace highlighted GUID with your application's
actual ID.
The URL in the "My Great Web
Application.url" file takes
browser to GoToApplication.aspx page of the UltiDev
Cassini Explorer, and passes your application ID as a
parameter. Cassini Explorer will find port assigned to
your application and will redirect the browser
to it. This will always correctly invoke
your application even though the application will get
different ports assigned to it on different machines at
the registration time.
Now to work around some kinks of the setup project, add
the "My Great Web Application.url" file to your setup project’s
User's Programs Menu folder:


Build the solution and install your application. After
the installation you should see the shortcut in the
Programs menu.

If you need
additional information,
please visit our support forum,
where most common questions have been asked and
answered. |