PDA

View Full Version : Windows Services and InstallShield 2011 LE



Wokawidget
11-03-2010, 09:57 AM
Hi,

I am using VS 2010 with the new MS recommended Install Shield 2011 LE.
Using the old VS deployment porjects I could easily create a windows service installer that registered my service.

I cannot for the life of me find this functionality in the LE version...to top that I've spent 3 days trying to find even a simple example on the web with no luck.

Is this something that only the professional edition will handle?

cheers,

Woka

john.whitley
01-10-2011, 08:06 AM
Hi Woka,

I am in exactly the same position. I have previously used the built in VS installers to register and start my Windows Services, and although the functionality is limited, it works and is pretty straightforward.

I called Flexera today to ask the simple question "Does the LE product allow you to install services" and the chap could not or would not answer. What he DID say is that Microsoft plan to ONLY support Installshield in future versions of VS and that I should buy Installshield Professional.

The fact that you have not received a reply to your simple straightforward question in several months, along with Flexera advising me I have to spend £1500 to continue doing what I have been doing in Visual Studio for years leads me to believe that lobbying Microsoft to not drop their own installer, or force Flexera to provide a straight answer to a straight question is the way to go.

One more try.

Flexera, can Installshield LE install, register and start a Windows Service or not? If so, please provide an example.

Thank you.

Stefan Krueger
01-13-2011, 04:56 AM
As far as I know this functionality is not included in InstallShield LE. However I also can't find it in Visual Studio Setup&Deployment projects. How did you do it in VS?

Christopher Painter
01-15-2011, 06:41 PM
Probably the same way *everybody* does it in VDPROJ:

http://blog.deploymentengineering.com/2006/07/msi-vs-net.html

Assuming IS 2010 LE ( Is there a 2011 LE yet? ) doesn't support authoring ServiceInstall / ServiceControl rows ( I haven't looked ) ... the easiest and best quality thing to do would be to create a merge module using WiX to encapsulate the file as a service and then bring it in as a dependency of your IS 2010 LE project.

In fact, that's a good way to make LE do many things it wasn't designed to do. But if you do any serious work with installs you probably will eventually want Professional edition.

Stefan Krueger
01-17-2011, 10:30 AM
Assuming IS 2010 LE ( Is there a 2011 LE yet? ) doesn't support authoring ServiceInstall / ServiceControl rows Correct, it doesn't. (And there's no 2001 release of LE yet.)


Probably the same way *everybody* does it in VDPROJ
Installer Class custom actions can be used in InstallShield LE, so the same method should be possible.

If you want to do the "right thing" and use the Service tables, you need to buy a higher edition of InstallShield.
(If I recall correctly: if your service is a .NET assembly in the GAC you can't use the Service tables but must use a custom action, maybe even after InstallFinalize)

Christopher Painter
01-17-2011, 11:05 AM
I love you Stephen but....

NO NO NO NO NO NO NO NO

Do not use InstallUtil custom actions!!!! It's reinventing the wheel at best and catastrophic at worst. Been there, done that, will never, ever do it again.

I just decribed a work around using merge modules to inject the desired behavior into LE without having to fork out extra money for Pro. Although I do believe Pro is inevitable.

Christopher Painter
01-17-2011, 10:07 PM
Installer Class custom actions can be used in InstallShield LE, so the same method should be possible.


I'm looking at LE and I don't see anywhere to wire up an InstallUtil CA. I do see where you can call EXE's so even a simple call to SC.EXE would be better then InstallUtil.

Stefan Krueger
01-18-2011, 11:14 AM
NO NO NO NO NO NO NO NO

I'm sorry if my previous post was misleading. I don't mean you should do this, I only wanted to mention that it's possible.

You can right-click the file and check "Installer Class". This should cause the assembly’s Install, Commit, Rollback, and Uninstall methods (derived from System.Configuration.Install.Installer) during installation.

hackaway
01-19-2011, 03:27 AM
I am using VS 2010 Professional with InstallShield LE.
I have a C# project which will run as a Windows Service.

My plan is to have a self installing service (http://anotherlab.rajapet.net/2006/06/self-installing-services-in-net.html).
I modified my Program.cs as follows:


namespace hackawaysprogram
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args)
{
if (args.Length > 0 && args[0].Equals("/i") || args[0].Equals("/u"))
{
if (args[0] == "/i")
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
}
else if (args[0] == "/u")
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
}
return;
}
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new DSmsService()
};
ServiceBase.Run(ServicesToRun);
}
}
}

I have tested this and it works. It installs or uninstalls the service. No paths etc required.


cmd > hackaways.exe /i
or
cmd > hackaways.exe /u


Now I plan to have a VBScript or JScript executing the /i & /u from the InstallShield LE project. Thing is that all this is new to me and I have never used any of those scripting languages nor have I used any custom actions or such.
Can anyone help?

hackaway
01-19-2011, 03:32 AM
I am using VS 2010 Professional with InstallShield LE.
I have a C# project which will run as a Windows Service.

My plan is to have a self installing service (http://anotherlab.rajapet.net/2006/06/self-installing-services-in-net.html).
I modified my Program.cs as follows:


namespace hackawaysprogram
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args)
{
if (args.Length > 0 && args[0].Equals("/i") || args[0].Equals("/u"))
{
if (args[0] == "/i")
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
}
else if (args[0] == "/u")
{
System.Configuration.Install.ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
}
return;
}
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new DSmsService()
};
ServiceBase.Run(ServicesToRun);
}
}
}

I have tested this and it works. It installs or uninstalls the service. No paths etc required.


cmd > hackaways.exe /i
or
cmd > hackaways.exe /u


Now I plan to have a VBScript or JScript executing the /i & /u from the InstallShield LE project. Thing is that all this is new to me and I have never used any of those scripting languages nor have I used any custom actions or such.
Can anyone help?

hackaway
01-19-2011, 11:07 AM
I will have to look into alternative paths. Wix & Merge module is one alternative as previously mentioned.

Stefan Krueger
01-25-2011, 06:04 AM
You don't need script to run an .exe as a custom action (or is this functionality blocked in the Limited Edition?).

hackaway
01-25-2011, 06:08 AM
You don't need script to run an .exe as a custom action (or is this functionality blocked in the Limited Edition?).
OK, well all this is so new to me that I don't know.
I know that the only scripts I can execute is VBScript or JScript not the InstallScript. Anyways, I solved it using .msm and Wix together with IS2011.

Christopher Painter
01-25-2011, 07:31 AM
And you don't need an EXE to install a service.

http://blog.deploymentengineering.com/2011/01/augmenting-installshield-using-windows_19.html

Also if I needed to run an EXE in a 2010 LE project, I'd use the WiX QuietExecCA pattern. It eliminates the cmd window popup, logs the output and handles a host of other problems that can occur when calling EXE's.

hackaway
01-25-2011, 07:40 AM
And you don't...
Anyone having questions regarding creating a service then check Christopher's blog post on the subject (http://blog.deploymentengineering.com/2011/01/augmenting-installshield-using-windows_19.html). Big thanks to Christopher!