Using Visual Studio 2010 I have created system service installer IndexingService (property ServiceName in installer) named Indexing Service (property ProductName in setup project).
Service installs and works properly but installer won't remove system service (and therefore won't reinstall it)
What should i look for?
UPDATE: I forgot to update custom action on uninstall
Actually i forgot to configure one of the custom actions properly.
Thank you, Cosmin Pirvu!
Related
I have created a msi which allows user to view license, select installation folder, and features to install. That all works well.
Now I need to create a bootstrapper that will check if framework 4.5 is installed, install it if not, and then install msi.
I can do this using WixStandardBootstrapperApplication.RtfLargeLicense, where I would install framework, and then execute msi with its own UI.
But what if I do not want to show two apps (msi over exe), but only one window?
Since my msi contains feature, standard bootstrapper does not provide interface where I can set features from msi, so I need to create a custom UI.
The problem is I do not quite understand how WixManagedBootstrapperApplicationHost works? I created a dll with new UI, and place it in Payload. When running the setup, when framework needs to be installed, WixManagedBootstrapperApplicationHost always invokes its own window which says:
Microsoft .NET Framework required for MyApp Setup. Click the "Accept and Install" button to accept the Microsoft .NET Framework license terms.
And after it completes installation of .NET Framework, then it invokes the UI that I Created in dll. Why would anyone want this kind of functionality, where my bootstrapper app contains totally different UI than the framework installation UI? Isn't the idea of bootstrapper with custom UI is to provide completely custom UI?
So, how can I provide my custom UI for that framework installation part?
I assume your own UI is C# and WPF? If your installing it on a machine without .Net then it's going to need to install .Net before it can show the WPF UI. I could be wrong but I'm sure that's unavoidable.
If you want to replace / modify the .Net install screen then this thread looks like it has the answer:
Wix Burn: Basic UI handling if No Net Framework is there
However if your saying the .Net install dialog is showing up over your UI at some point in installation then you need to set the Install command to "/q" which means quiet (no UI).
I'm developing a Windows service in VS2012 and the setup/deployment part has been removed. So I'm not able to create a setup project. I would like to hear what you guys could recommend for a good easy to use the installer. I need to take some inputs, only strings, under the installation of the service. I've been looking at WiX but that seems a bit complex, and I only got 1 or 2 days to make this installer.
So what installer should I use other than Wix?
I've had really bad experiences with InstallShield LE (the one that comes with Visual Studio 2012), especially for Windows Services. The features that you need to install a service (custom actions, etc), don't come with the light version.
What I'm planning to do for the current Windows service I'm working on is to build it with Topshelf, which (amongst other things) means installing your service is as simple as running MyServiceApp.exe install. I'm sure even InstallShield will let you run your app once it's installed, and then your app/Topshelf can install the service component.
If InstallShield doesn't work for you, I've had good results before with NSIS. Simple, powerful, free, decent documentation. It looks a bit clunky.
Here is a list of setup tools which can get you started:
http://en.wikipedia.org/wiki/List_of_installation_software
If you don't have a lot of time for creating the installer, I recommend using a commercial tool like Advanced Installer or InstallShield. You need a license, but they are focused on usability (do more in less time).
You can do it with InstallShield LE... You can add custom actions "After Register Product" for install and for "After System Changes". These custom actions can run an EXE on the machine.
Make sure you run the command line tools "in system context"
After Register Product run the version of InstallUtil to your version of .NET
eg.
path=C:\Windows\Microsoft.NET\Framework\v4.0.30319
command=InstallUtil.exe "C:\Program Files (x86)\XXX\YYY\ZZZ.exe"
replacing XXX YYY and ZZZ to match your install
After System Changes to delete your service name run
e.g.
sc delete "servicename"
Note you need support for the custom actions within your own service executable (you needed this in earlier VS too).
You can find more information about SC here:
http://support.microsoft.com/kb/251192
To add an installer for a service, you just need to right-click on the designer for the service and click "Add Installer".
Here's the walkthrough:
http://msdn.microsoft.com/en-us/library/zt39148a.aspx
I've read every stackoverflow article on MSI installations, but I cannot find the solution to my problem:
I have a VS2010 solution with 5 projects, all targeting .NET 2.0:
DLL A, no project references
DLL B, references DLL
A Windows Forms App, references DLL B
Windows Service, references DLL B
Setup Project
DLL A and DLL B are set up as to be installed to the GAC at install time. I'd like to start the service once the installation has finished, but according to what I've read, the assemblies are not registered until the very last step. I have proven this by attempting to start the service on the AfterInstall event of my ServiceInstaller class and I get the following error:
Error 1001. Could not load file or
assembly 'DLL_B', version 1.0.0.1,
Culture=neutral,
PublicKeyToken=5e297270603814f4' or
one of its dependencies. The system
could not find the file specified.
But of course, once installation is complete, I can manually start the service and it runs fine. Also, in Windows XP, I can usually have the service started at application launch (I have a checkbox with Launch Application as the last step of the installer). But in Windows 7, permissions are no longer elevated at that time and starting the service throws an error.
How can I achieve the installation and starting of the service without forcing a reboot? To quote my client: "Its 2011 now and that shouldn't be necessary.", and I agree whole-heartedly.
Thanks ahead of time.
This is a well-known issue with the GAC. One option might be to use two separate installers and daisy-chain them. This is the way we have chosen to get around the problem of deploying Microsoft VC runtimes on Vista and later. If you use the merge modules, any services that depend on them won't start. So in effect you put your GAC-destined components in a pre-installer whose transaction will be completed and committed before you run a second install that installs and starts the services that depend on them. Ugly, I know, but better than a reboot.
A solution is to use a custom action which runs after InstallFinalize in InstallExecuteSequence table. This custom action should use the msidbCustomActionTypeAsync and msidbCustomActionTypeContinue flags so it runs in a separate process after the installation is finished.
This cannot be done with a Visual Studio setup project, but there are a lot of alternatives: Orca, WiX, a commercial setup authoring tool etc.
I worked around this issues slightly differently: I installed my assemblies not only in GAC, but also into the Application Folder. My GAC-bound assemblies were already found as dependencies, so I put those into GAC (and those indeed end up there only after all custom steps executed). I also added same assemblies as primary output to the Application Folder, where my InstallHelper DLL with custom actions also resides. This way during installation local copy from Application Folder is used.
Is it possible/recommended to use the InstallService element to install a Windows service written in managed code (C#)? (I tried it and it does install the service, but the service won't start)
Or does this require a custom action which invokes Installutil?
Or is there another way to do this?
I'm in a study of wix myself right now and has just succeeded to install/uninstall a managed service with just a standard ServiceInstall/ServiceControl way (and why not if we can just use sc for it).
From what I read and agree with, using a custom task with installutil is considered a bad practice:
I used to install perf counters in my .net installer, but now I'll just go the wix way for it.
By the way I had to add a ServiceControl element so service was started after the install (Start attribute) and more importantly for me, completely uninstalled during uninstall (Remove attribute).
<ServiceControl Id='ControlStansWinService' Remove='both' Name='StansWinService' Start='install' Stop='both' Wait='yes' />
I've published my findings so far here, hope you can find it useful.
You should use the WIX InstallService element as it does all the work of installing the service and starting and stopping/removing the service on install and uninstall. If you use custom action to invoke InstallUtil to install the servive, then you have to do the start and stop of the service again manually using CustomAction.
How do I create a Setup And Deployment project that can run any number of times on a machine without requiring an uninstall?
I've created an installer to install a WCF service to an IIS directory. It does more than just xcopy, it asks the users questions to correctly setup web.config.
The problem is when it can only be installed once per server without requesting an uninstall.
"Another version of this product is already installed...."
Typically the service will have 10-15 separate instances per server (each instance pointing most likely to a separate database, or a different security context)
I can't figure out how to set up the installer to do this.
Ok, I've got this working, I figured I'd answer it.
I downloaded the Orca windows installer editing tool (Part of the Windows SDK)
In the InstallExecuteSequence table, changed the following values to 0
RegisterUser
RegisterProduct
PublishFeatures
PublishProduct
This should allow the installer to run over and over without uninstalling.
It sounds like your program has 2 parts rolled into 1 - an installer and 1 UI based update service. Could you separate the 2 and have the installer check for being already installed and if so, fire up the UI program to run config setup.
If you want to install multiple versions of the same application you must do 3 things:
Ensure each version installs to a different folder, so subsequent installs will not overwrite previous ones.
You do this by changing the DefaultLocation property of the Application Folder in the File System panel
of the deployment project. A good policy it to use the application version as part of the location; e.g.
[ProgramFilesFolder]\[Manufacturer]\[ProductName]\[ProductVersion].
Ensure the ProductCode property of your deployment project is different, so subsequent installs
will not uninstall the previous version. The easiest way to do that is to...
Change the Version property of your deployment project. Visual Studio will ask if you want to change
the ProductCode property; you do.