8

I have an ASP.NET MVC application. And I need a way to deploy it.

BUT

I don't need to just copy it to my own web server. It's not meant to be a website that it available on the Internet. No.

Instead, I need my users to be able to install it on their own server. Which may or may not be visible from the Internet.

That is, I need to create an MSI package (or EXE self-extracting installer, or whatever) that my customer can just double-click on, and the MVC app should get installed on their local IIS.

I can, of course, just plain write some code that would extract the files, copy them to the local hard drive, and then create a website or a virtual directory in IIS, blah-blah-blah. But something tells me there should be an easier way. Like, say, a WiX extension that already does that. Or something.

Note: the application is very simple. No need for databases, special privileges, SMTP server configuration... Or, in fact, any kind of configuration at all. Just copy the files and create IIS app.

Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172
  • 1
    Did u try webSetup Project type in Visual Studio ?? – Furqan Hameedi Apr 26 '11 at 12:21
  • 1
    @Furgan: Yes, I did. Firstly, I have to specify all copied files individually, which is a major source of subtle errors having to do with missing or misversioned files. Secondly, I couldn't find a way to AspNetCompile the app before building the package. And overall, there just isn't enough fine control over the process. – Fyodor Soikin Apr 26 '11 at 12:56
  • Have your read this post? : http://stackoverflow.com/questions/686190/how-do-i-install-an-asp-net-mvc-application-on-iis-7-using-wix – Peter Ritchie May 15 '11 at 13:59

4 Answers4

6

This might need some coding but (if you need a pretty presentable UI) there is a feature in Visual Studio build deployment package.

Build delpoyment package

Where it will build you a package that your customer can run to create all the necessary things in IIS, so IIS settings are applied as well. Scott Hanselman has a series of posts about it. You can change the default settings from package/publish settings.

package/publish settings. To deploy the packages you must have msdeploy.exe. You could send the zipped folder and when your customers run the .cmd file they will be up and running in no time. However if you want to put pretty bows around the package you can run it from a C# application ther will be some coding required but I'm sure that wont take more than 15 minutes.

Usage:
--------------------------
{0} [/T|/Y] [/M:ComputerName] [/U:UserName] [/P:Password] [/G:UseTempAgent] [Additional msdeploy.exe flags ...]

All you basically have to do is

System.Diagnostics.Process proc = new System.Diagnostics.Process();
const string filename = @"/*some file location*/";
proc.StartInfo.FileName = filename;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sevki
  • 3,592
  • 4
  • 30
  • 53
1

What about web platform installer? Some links that may help by using web platform installer for your product:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Giedrius
  • 8,430
  • 6
  • 50
  • 91
  • I don't see how it helps. I still have to somehow create an MSI that will do all the job, and the whole point of the question was how to do it. – Fyodor Soikin May 13 '11 at 10:44
  • In one of articles was mentioned how to create package for web platform installer: http://learn.iis.net/page.aspx/578/package-an-application-for-the-windows-web-application-gallery/ – Giedrius May 13 '11 at 12:01
1

Whenever I run into the need for a complex install I always turn to WiX.

You can use WiX to install your MVC based website and then use the IIS Extension (http://wix.sourceforge.net/manual-wix3/iis_xsd_index.htm) to create a new app pool and site for it to run under.

A few issues I can think of that you might want to look into deeper would be:

  • What if the user doesn't have IIS installed?
  • What if they do not have the MVC Tools package installed (aka to bundle or not to bundle)?

Other than those points I think WiX + the IISExtension will easilly cover your basic, copy files and create website requirement.

BGregorius
  • 51
  • 4
0

There are web-specific setup projects in Visual Studio that you can use, though I believe the various deployment project types are being discontinued in favour of WiX at some point.

I don't know much about WiX, but I'd definitely look at that first to see if it'll do what you want. I imagine I'd end up with a WiX package that extracted the files to the place the user asked for them, and then executed a PowerShell script (deployed in the package) to configure IIS etc as necessary.

Neil Barnwell
  • 41,080
  • 29
  • 148
  • 220
  • Yes, I did look at the "Web Setup Project", and it doesn't quite work, for various reasons (see my comment above). The PowerShell script is actually what I'm trying to avoid doing. It's quite easy to make a script that works once, but it seems like a nightmare to make one that will work in all possible configurations, or at least print a decent error message. I'm hoping for something that already exists. Can it be that I'm the first one to face this problem? – Fyodor Soikin Apr 26 '11 at 13:03
  • Erm, the point of a script is that it *will* work in exactly the same way in other situations. If you can't write a script or other automated process that can cope, then you can't remove the human factor at all. If you're saying you need to take input from a installation engineer in order to decide where the code is installed and what the virtual directory is called etc, then you could pass those options to the PowerShell as parameters. Otherwise, you're going to have to buy something like InstallShield (£££), which will have more customisation options than you can shake an XML file at. – Neil Barnwell Apr 26 '11 at 15:09
  • I'm not saying I can't write such a script. I'm saying it looks like a nightmare at the moment. Of course, I will do it if I don't find any other options. – Fyodor Soikin Apr 26 '11 at 16:53
  • WiX was unfortunately not chosen as the way to do - even after much internal work at Microsoft on it. Managers change, etc and it was pulled from Visual Studio 2010 and installshield was provided again. – Adam Tuliper Apr 26 '11 at 21:22