Welcome Guest! To enable all features please Login or Register.



Creating Visual Studio setup project bundling UWS
Ultidev Team
#1 Posted : Wednesday, October 26, 2011 8:35:52 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
The article provides step by step guidance for creating an installer for a ASP.NET web application that ships along with UltiDev Web Server Pro (UWS), using Visual Studio Setup Project (InstallShield is supported too now and the walk-through doc is being prepared). This article assumes that the web application project is already a part of Visual Studio solution. We used Visual Studio 2010 to produce this walk-through, but the process is virtually identical for Visual Studio 2008 and 2008.

The process of creation of an installer is very similar to one that bundles old UltiDev Cassini Web Server and at a high level consists of the following steps:

  • Installing UltiDev Web Server Pro.
  • Adding a new Setup Project to a solution containing the web application to be made redistributable.
  • Adding UltiDev Web Server as a setup project prerequisite.
  • Adding custom actions for application registration and unregistration.
  • Installation package will need to include Setup.exe, as it's setup.exe and not the MSI file that contains information about UltiDev Web Server being a prerequisite.

Here are the details.

Start with adding a new Setup Project to the solution containing your web application or web site project.

Please note that we used regular Setup Project, and not Web Setup Project. Also, we have used Visual Studio setup project instead of the InstallShield project, which will be described in another walk-through doc.

It could make sense to change .NET Version Check in Launch Conditions to "Any", because it seems that if you specify, say, .NET 2.0, the installer will look for it while .NET 4.0 may be installed on the target system and not requiring 2.0 while running 2.0 applications just fine. It might make sense to specify 4.0 for 4.0 applications, but if you ship 2.0 app, looking for a specific version of .NET Framework may not be a good idea:

Microsoft Visual Studio won't include your newly created setup project in the list of project required to be built. So for at least Release configuration you will need to include Setup project into the build sequence:

Now let's add UltiDev Web Server as a component to the bootstrapper of your installer. Please also add .NET Framework 2.0 with SP1 or SP2 as a prerequisite because UWS depends on .NET 2.0 SP1 even if .NET Framework 4.0 is present.

Then let's adjust some installer file properties:

Next, let's specify the location of the web application on target systems. We recommend putting the web application in a separate folder, because there will be other files placed in the installation destination folder:

After that web application code and content should be assigned to the web application folder:

After that's done, the destination folder in the Setup Project should look like this:

If you build your installer at this point and run Setup.exe (not MSI, and not by right-clicking setup project and selecting Install item), the installer will download and install UWS on the target system and then install your web application files. Your application, however, will not be automatically added to the sites hosted by UltiDev Web Server.

Next half of this article will show how to register your web application or site with the UWS.

A web application or site can be registered with the UltiDev Web Server using one the following methods:
- Registration utility provided by UWS.
- .NET API provided by UltiDev Web Server and located in GAC.
- COM API provided by UltiDev Web Server.

This article focuses on implementing command line registration.

The first challenge is imposed by Visual Studio Setup Project that does not allow to launch an arbitrary EXE on the target system. In order to run a registration utility your installer must include an EXE that will start UWS application registration utility. Please add our Starter.exe utility as an assembly to the Application Folder of the setup project. Starter utility is located at "C:\Program Files\UltiDev\Web Server\Redist\Starter.exe":

Application project should look like this:

Now you are ready to invoke application registration utility from your setup project's custom actions. To begin, add Starter.exe to Install, Rollback and Uninstall custom actions:

Then set each custom action's InstallerClass property to false:

And rename custom actions to something meaningful:

Now it's time to get to actual application registration and unregistration.

We'll start with unregistration because it's easier. To ensure your application is unregistered when it's uninstalled or when failed installation is rolled back, please set Arguments property of Rollback and Unsintall actions to
/s "[ProgramFilesFolder]\UltiDev\Web Server\UWS.RegApp.exe" /u /AppID="[UpgradeCode]

What the snippet above does is it tells the Starter.exe to run UWS.RegApp.exe with "unregister" command and application ID set to setup project's UpgradeCode. UpgradeCode code is used because it should stay constant across multiple versions of your application and will ensure that old versions of your application application are replaced in UWS with newer one when new ones get installed.

Please note that command line starts with "/s" parameter, which tells Starter.exe to wait for the registration program to exit. This is especially important if you are registering multiple web applications.

Finally, let's specify command line arguments for application registration. First, be sure to familiarize yourself with application registration concepts. The sample below is just an example, and you may copy only the beginning part of the Arguments property value -
/s "[ProgramFilesFolder]\UltiDev\Web Server\UWS.RegApp.exe" /r /AppID="[UpgradeCode]" /path:"[TARGETDIR]\WebApp"
The rest of the arguments are specific to your application. Other important parameters are "aspnet", "vdir", "defaultdoc", and others. Please refer to the the complete list of UWS.RegApp.exe command line parameters for more information.

This is an example of how application registration arguments may look like:

If you build and install your web application, it will register itself after the installation, and if you bring up the UWS Explorer, you will see your application hosted and ready to serve:

When installing on end-user systems, your application should not expect that any particular TCP port will be available. Therefore, installing the application only on port 80 is not a good idea as target system may have another web server occupying port 80 without port sharing. To deal with the situation, the best practice is to let UWS assign the port to your application. When registering your application, it's recommended to use "/ListenEndpoints:http://*:0" parameter to let UWS find and assign free port.

Starting with UWS build 15, UWS.AppReg.exe utility started creating desktop shortcuts for registered applications. These shortcuts are app-settings-agnostic, i.e. they will work even if application gets moved to another port, gets another vdir or default doc, etc. (Shortcuts can also be created using UWS.Configuration API's application registration methods.) UWS can create up to three shortcuts icons per application, to accommodate needs for different shortcut file locations, hostnames, icon images and start pages. See "/SHORTCUTxxx" parameter info for more details.

Another frequently-requested installation feature is UWS.AppReg.exe ability to launch newly-registered application in a browser. See "/AUTOSTART:timeout|startpage" parameter info for more details.

After your application is uninstalled, your application will be gone from the UWS Explorer list, but UltiDev Web Server will remain on the target system. Your installer should not attempt to uninstall UltiDev Web Server after your application is uninstalled as other applications might have been registered with UWS after your application was installed. Let the user decide whether to uninstall the UWS.

Please let us know and post your installation questions here for the time being.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
#2 Posted : Tuesday, March 8, 2016 2:54:25 AM(UTC)

Message was deleted by a Moderator.
Rss Feed  Atom Feed
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.