C# .Net - deployment "very" custom application - c#

We are working on deploying a very custom application.
The application is the main program (and only program) that will run on the PC, but it depends on multiple 3rd party installers that must be installed via separate setup programs. Some of these are standard MSI, install shield, other outdated setups, etc.
On top of that we must deploy SQL Server Express 2005, install IIS if it is not found and setup a website.
Our final end user deploying this will be a person with technical experience on a new "out of the box" PC with XP SP3.
What is a good option for developing this? WiX? Visual Studio setup projects may not cut it. There is also the issue of somehow running other MSI's while an MSI is already running.
Would it function better as a standard C# application that requires .Net to be preinstalled? Then it would merely prompt for a few options then run several installers I suppose.
Any thoughts? We'd prefer to stick to C# .Net.

Doesn't XP SP3 already have a .NET runtime installed?
If your end user is someone with technical experience then it seems reasonable to sacrifice some of the "wizardness" of an MSI package for the flexibility of something a little more raw, such as a Ruby script, Powershell script, or .NET console or Winforms app.

This comes down to the benefit vs. cost.
If this is only to be run on a single or small number of target PCs and you have the ability to support the install (even remotely), I would recommend going to a manual install for any 3rd party dependencies.
It will be much easier to provide each package's installer with written instructions and provide than to write/test/debug (and probably still support) a complex, fully automated installer that will only be used once or thrice.
If there will be many installations, the automation will give more benefit.

There is an installer product called Inno Setup that might suit your needs. It allows for custom scripting so you can detect whether all of the dependencies are installed.
If some of them are not installed then with some scripting the installer can download and install the 3rd party dependencies before installing your app. Some help with that can be found at the Code Project article. (http://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx)
The only problem with this route is the scripting language is in pascal.
Just a question, is the company you work for supplying the boxes because if you are then couldn't you pre-install the software? At least that way there is one less thing that can go wrong.

WIX is a fairly flexible way to create the installer (although the learning curve can be quite a bit as the documentation still is lacking). That would probably be your best bet for installing the components that are actually your product's artifacts. Have it check that the required components are installed, but I wouldn't try to launch installers off of it. Instead, like Seth mentioned, write a Powershell script/VBScript (or Console application) that will do the component checking and launch the old installers for user in the order necessary. Of course you would need a way to capture when the installer finishes before continuing on (don't know if VBScript really has that capability, so Powershell/Console app may be a wise choice). And the final installer called would be your product. This way if there's reboots required the installer can be ran the exact same way and would just keep checking for required components and firing off installers as needed.

Related

Implementing development processes - versioning and installers

In my team we create assemblies to attach to extensible released software created and published elsewhere in my company. These assemblies are often specific for an individual client, though some are reused. I want to introduce a couple of standards into this environment - version numbers and installers.
Currently, many assemblies go to clients without adequate versioning. I want to institute automated version number updates so when a client has a problem we can be sure which source code was used in their software.
Currently, assemblies are installed by the individual copying them manually to the correct path and performing any necessary registration. I want to force people to use an installer package so the path and registration is handled automatically.
I could implement the first step by getting people to use:
[assembly: AssemblyVersion("1.0.*")]
But I'd prefer to update the AssemblyFileVersion rather than the AssemblyVersion. This is because I understand that advancing AssemblyVersion combined with our manual installation can lead to multiple versions of an assembly being registered. AssemblyFileVersion doesn't update automatically, and I'm wary of a solution that requires developers install 3rd party tools. If we had a proper installation process, the problem would multiple versions would go away.
For the second step, if I use a Visual Studio setup project then adding the assembly causes it to try to add other assemblies from the original published software, which I don't want. I assume I can create this as a patch somehow, but I've not worked that out yet. Of course, an installer will require reliable version numbers or things will go badly.
It seems clear having written this that I need to advance both issues simultaneously, but I'd really rather approach one at a time.
Any thoughts for the best way to get over these two issues?
I don't have nearly enough information to point you to a solution. What are you using to build your application and installers? Desktop F5 build? Team Foundation Server? Cruise Control?
Things to realize:
1) Visual Studio Deployment Projects suck. Yes, I'll stick by that comment. In your case, the dependency scanning problem you have is unfixable. Even if you right click | exclude the dependency it could scan a new dependency at build time. We even wrote visual studio automation to open the project, right click | exclude everything and then save it on the build machine to avoid this problem. Trust me, it's a horrible road to go down. Even Microsoft knows it sucks and that's why it won't be in the next release of Visual Studio anyways. Use other tools such as Windows Installer XML or InstallShield Limited Edition or Professional.
2) You must update AssemblyFileVersion. This is such a core/foundational tenant of Change Management and it's critical in getting Windows Installer upgrades and patches to work. AssemblyVersion can be changed at your discretion and is only applicable to Strong Naming and IoC scenarios such as Prism where you write rules on what constitutes a valid class for injection.
3) 1.0.* isn't what you want. You want a system that increments your version and passes it into your build automation. What you use will depend on what you are using for build automation. I use Team Foundation Server and a project in CodePlex to do my versioining.
4) You should never be building on a developers machine. You should always be using a clean build machine with automated scripts and not F5.
If these are released applications, then the installer method is fine. If you are adding libraries through this method, and not necessarily the actual application, then something like NuGet (package manager) is an option. NuGet itself is a bit infant and needs to grow up a bit, but I think it should fit your basic scenario.
If you have published software, a bootstrap on the client that calls for updates and then runs the update installer is a good pattern.
The basic answer is you have options, depending what bits you are employing and should take advantage of the one(s) that fit your needs.

What installer options do I have for bundling a windows service along with a WPF application?

I've already looked at C#: Making an Installer that installs both a WPF application (ClickOnce) and a Windows Service but that never answered my question. I have a similar set up: a WPF application and a Windows Service. I'd like one installer that installs the Windows Service first, then installs the WPF application. Also, it has to be able to open firewall exceptions as well.
Anybody have any experience with any products that can do this? I've got the feeling that InstallShield Premier can do this but I'd prefer not having to spend $500 or so for a license.
Thanks!
Have you looked at WIX? It's an open source tool for building MSI setups. It's pretty well supported. I haven't used it to do what you are asking, but a quick search did reveal a firewall settings extension for WIX: http://www.joyofsetup.com/2008/05/17/new-wix-feature-firewall-extension/
Have you looked at Nullsoft Scriptable Install System(NSIS)?
A little while ago, I decided to take a little utility I wrote and make redistributable1. I looked at a whole bunch of standard installer options (i.e. VS IDE vs. different flavors of InstallShield) and one thing I didn't like is that they could all do trivial things, but if you needed something just a tad more complicated, the best option was non-free InstallShield or you are out of luck.
Then I came across NSIS. From my initial impression, it looks to be a full blown installer builder. It supports most features, even complicated ones and it is open source. Even for things that the product itself doesn't support, there's a strong community of other developers that post their own scripts and add-ons.
It is probably not as easy to use as InstallShield (I remember IS had visual and very friendly IDE). This one is more scripted, so you need to understand their language. But it's not difficult, I was able to ramp up and create and install package within one day.
1-If you wish to see what NSIS script looks like, you can follow GitHub link in my profile. The project is called "Droppy"

Creating a "sure to run" app / installer in VS2010

I need to create a simple installer of sorts for a different application. That other application already has it's own simplistic installer, and I don't want to meddle with it.
The reason for my own installer is to allow the user to install SQL Express if (s)he so chooses, and also to pre-install any other basic requirements for such a procedure.
At the moment, here's where I'm at:
I've created a single Windows form application, with big buttons (this is for a user which likely won't be very good with computers) to install SQL Server Express (using silent install with a predefined set of arguments) or the actual application, along with some helpful text to let the user know what's going on. Something along the lines of Visual Studio autorun window.
I've also added the standard set of pre-requirements to the application (.NET, Windows Installer).
Everything works OK if I run the app by using the executable. HOWEVER, if I publish it to create a ClickOnce application (so the pre-requisites are installed when needed) and run it, it stops running other installers.
EDIT: Apparently the problem with not being able to run other application from a ClickOnce application is only on my end, and probably deserves a new question, not necessarily here on StackOverflow (perhaps on MSDN forums?).
In your program before launching the installer you can check if .NET is installed. Its pretty easy to check if a particular s/w or a version of s/w is installed. Write a program that will check HKEY/LocalMachine/Microsoft/Windows/CurrentVersion/Uninstall and in that there will be list of programs that have been installed on that machine. If you find then go ahead with your install else suggest user that he needs to install pre req.
When you create a setup project you can right click on the setup project, go to properties, and click on pre requisites. In that you can mention which version of .NET framework is needed and then give the location of the framework. In this link look for Huggy Bears response eggheadcafe.com/community/aspnet/2/10131905/setup-project.aspx
I've settled for a "Click Once" application. It can install all required .NET components needed for it to run, thus becoming an "sure-to-run-non-native-C++-code-splash-screen".
Granted, there ARE issues with Click Once, but this is far better than nothing. It's also better than running C++ or unmanaged code applications. ;)

What's the best cross platform approach (Windows/Mac) to deploy a simple service/daemon (with simple UI)

I'm getting confused re the range of options for development & deploying some simple code & UI to both Windows & Mac. Can anyone assist re a good direction here. I do like Ruby, however if it makes sense to move away from this (e.g. java, c#) then so be it. Which development option would people suggest for this?
REQUIREMENTS
1. Support for Windows & Mac
2. The installation should be one-click and package all required dependencies as much as possible.
3. Scheduling capability required - so either via (a) installed as a service/daemon, or (b) ability for installation to schedule periodic call to script (former is preferred)
4. Functionality component requires - ability to access/parse web-sites, and then ability to make HTTP(S) calls out to my site to store parsed data. So heave on HTTP(S) methods. Proxy support required in app, so ability for user to enter host/port/username/password for the proxy server.
DEV OPTIONS ?? - This is where I need help/advice. Some of the many options that come to mind:
1. Develop in Ruby and then find packaging product to create Windows & Mac installation packages - not sure how doable this is yet? Especially if I need the installation to effectively install as a service.
2. Develop in Java for cross-platform? but then needs users to have installed JRE?
3. Develop as Firefox addon? I'm not across this, but even if you can write custom code, then the issue would be firefox would have to be running I guess.
4. Develop windows & Mac versions separately, for example using Visual Studio Express to develop the windows version (assuming it can do HTTP work & create packages for installing services).
What would people suggest here? (would be nice to write once, push a button and then get the Mac & Windows installation packages spat out)
Thanks
I've written cross-platform C++ code and this was the kind of decision we were faced with.
Apologies in advance, but I'm not aware of any cross platform libraries that you can use for this, the systems are sufficiently different that they will require different deployment strategies.
Suggestion 1:
build your application in Mono
build two deployment strategies, separating the deployment issues into the "installers"
on windows deploy with some scripting language or installer application that inserts your app into the task scheduler, or write some simple C# code (see below)
on the Mac use the built-in UNIX cron demon to periodically call your app.
I think this strategy is fairly simple. The platform-specific effort is centered on the deployment. The app uses no resources until it runs, and it uses simple mechanisms to activate it. Logging and error handling can be done using the file system.
Suggestion #2:
write the platform independent code as an assembly
write the platform-specific code for each platform as necessary:
on windows that's a windows service or a scheduled app installed with click-once
I've been away from a mac long enough that I don;t know what the strategy is there
again, additional effort for the deployment
This solution has the overhead of writing more specific code to interface with the particular services that the OS Supports. The benefit is that it should co-exist better with the OS with the additional effort (ie: hook into OS-level resource management, reporting, logging and error management).
Note: C# interface to the Windows task scheduler here Unfortunately it's probably not Mono-compatible.
Mono will support the cross platform Windows and Mac requirement.
Mono allowed me to develop a Windows Forms executable assembly on my Windows environment and then simply execute the exact same executable using Mono on OS X.
Some of the GUI controls behave a little differently, but if you're writing a Service you will probably not be creating a complex GUI.
Checking the mono docs, I see the System.Net.WebClient class is implemented and provides a simple cross platform way to retrieve data over HTTP.
I used Visual Studio 2008 on a Windows machine to develop the application completely as I would any other .NET Windows Forms app. Then the resultant executable can be run directly on the Mac machine by passing it as an argument to the mono runtime.
You probably want to treat installation/deployment as a separate issue from the implementation of the actual application code. You may well need a platform specific installer for each supported platform, but each installer will deploy the same single binary (or set of binaries) on each platform thanks to Mono.

How to create setup for any exe?

I have .NET exe, I want to create a setup for this and after any login or restart this exe should be called automatically.
As you are deploying a .NET application, there are multiple ways in which you can approach this challenge.
There are many questions you have to consider when choosing an installer strategy. These include:
How do I plan to distribute this software?
Is the software supposed to be connected to the internet in any way?
What users is the software targeted towards?
Do these users have specific computer installations, such as all having .NET Framework already installed?
How should I approach the problem of updates to the software?
After answering some of these questions, you can get a general idea of how you should distribute the software. Then, you need to consider the various installers, and Wikipedia has a convenient list that compares them, which might help you.
Below are some examples of what might work for you:
ClickOnce deployment built into Visual Studio - my current favorite way, as this is the most easiest for users and for developers because updates and interaction is extremely simple
NSIS (Nullsoft Scriptable Install System), an open source scripting system for such installers. A great tutorial on packaging and checking for the .NET Framework with NSIS can be found here.
InstallShield (from Macrovision) - a heavily used installer system, but this one is not free, unlike other solutions
DreamShield - I haven't tried this one, but it appears to be a viable solution.
WiX (with Visual Studio plugin)
Deployment of applications is a very tough part of software development, especially in .NET, because how can we know, for example, whether the potential user already has the .NET Framework installed on their system or not? Or what version is installed? Thus, we must use tools like ClickOnce and NSIS to help.
To your question about how to start your application immediately at login, there are four ways to approach this:
Add registry key to start at login/bootup - MSDN explains that very well here. However, most installation systems allow you to automatically configure the registry key for bootup addition.
Use the Windows Task Scheduler to schedule a "task", in other words, to create a task that runs at startup. There is a .NET library for that here, I've used it in two of my applications that run on a specific schedule, it works great!
Adding the path to your executable into the Startup folder located at C:\Documents and Settings\All Users\Start Menu\Programs\Startup(that is for all users - for single users you can customize the username in that path). By the way, that location is in Windows XP, it may be different in other version of Windows.
If your application is a Windows Service, you can already automatically start at bootup, through svchost! There is a simple service configuration that will allow you to accomplish this.
Hope I helped!
You can use Inno Setup for the specific tasks described in the other answers.
By setup, I'm going to assume you mean the conventional installer. A good open source solution is NSIS. If that does not work, here is a more complete list.
As for having it start whenever the computer restarts/you login, that is platform specific (the installer can be platform specific if the program is). On windows, the installer needs to add a shortcut to your program in the folder
C:\Documents and Settings\All Users\Start Menu\Programs\Startup
(that is the easy method, there are surely more complicated registry settings).
This blog post lists a few useful links to info about Setup and Deployment projects using Visual Studio.
You could also google with the keywords ".net deployment project".
Although not .NET specific, you can try InstallJammer. Its open source and multiplatform.

Categories