Installing srvany.exe to run a jar file as a service using InstallShield (without editing the registry) - windows-services

We are trying to install a Java program to run as a windows service. Of the various available options(JSW, YAJSW, Launch4J, procrun, WinRun4J etc etc), we would like to use srvany.exe and install it using InstallShield. The Windows documentation says ...
Using RegEdit : create a "Parameters" key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
Using RegEdit : within the newly created "Parameters" key , create a string value called Application and enter the full path to the application you are wanting to run as a service.
Is there a way to achieve this using InstallShield without using InstallShield's registry editor? Is there an InstallScript call that can take care of adding and removing "Parameters" to the srvany entry in the registry? The solution should to work for Windows 2008R2 & 2003R2.
Any help will be greatly appreciated.

Assuming you are using a Basic MSI project type, I find a combination of the ServiceInstall, ServiceControl and Registry tables to be a good solution. Due to the fact that ServAny is really just a thunking layer, the ServiceInstall table can't fully describe the service without a little assistance from the Registry table. Still, no custom actions should be needed and the MSI will be very solid and robust.

As we were not able to find a favourable solution within available time, we decided to not use the srvany.exe. We decided to use YAJSW and within InstallShield use "Text File Changes" to modify the wrapper.conf for the YAJSW to launch our java application.

Related

Is there a way to update a cloud app instead of redeployed?

I was starting Windows Azure using WebSites, now I'm facing with the situation where I need Crystal Reports in my site, so I'm looking for a way to install the Redistribute Files to use it in my web page to generate reports.
I follow this page:
http://dotnetspeak.com/2012/07/running-crystal-reports-on-windows-azure
So instead of having a simple website, I'm gonna use a cloud app. Unfortunately, I'm updating frequently my website (role in Windows Azure project).
Do I need to redeploy all the time my cloud app each time I update my MVC project? Because it takes so long (like an hour, because I included a msi installer)
Thank you
Unless you build some custom extensibility into your application with some very robust dependency injection, yes, you have to redeploy.
EDIT: After re-reading your question again, I realised that you're using Windows Azure Websites.
The correct way to accomplish this is to use a webrole rather than the Websites
What you need to do is to store the installer as a blob in Cloud Storage.
Then part of a Azure Startup Task you can download from the blob and execute the installer.
If possible, you can also use the WebPICmdline (i.e the Web Platform Installer Commandline) to download and install for you from the Startup Task.
Steve Marx has done a few posts on using Azure Startup tasks. Here is one of them http://blog.smarx.com/posts/windows-azure-startup-tasks-tips-tricks-and-gotchas
Adding a bit to #Robert's answer: If the actual execution of the MSI is taking an hour, then this is not a very good use case for web/worker roles. Anything that takes more than a few minutes doesn't really fit well with the stateless scalable model. If that's the case, you should consider running a Virtual Machine for running Crystal Reports. Then you can use your web role for everything else.
If, on the other hand, the one-hour time is mostly consumed by the uploading of the MSI, then I'm completely in alignment with Robert: Store the MSI in a blob, and then download it to your role instances upon startup.
I would suggest to split your single Cloud project into two - one for Crystal Reports only. This way you can deploy it separately from MVC site. You could also build extra smarts into start up task, maybe checking if Crystal is already installed. However, I think splitting them up should be good enough for you
Normally the update process does not lead to an complete re-image of your webrole, only the approot gets destroyed! Here you can find a very detailed information about what is happening on update and deployment: http://msdn.microsoft.com/en-us/library/windowsazure/hh472157.aspx
What does that mean to your problem? Code deployment is an "in-place update" process. If you install Crystal Reports in Drive C: or D: it wont get destroyed on each deployment.
In your Start-Up Task you have to check, whether the software is already installed, or not. In case it is not installed, just install it, as mentioned above on Drive C: or D:
Edit: I got the Point: Does your update Process takes so long, because of the file-size of your MSI? If so, i also suggest to upload the MSI into Blob-Storage.

How to install windows service using wix and not using ServiceInstall

I need to install a windows service using wix. Unfortunately ServiceInstall doesn't fit my needs. It doesn't allow to specify service file explicitly and needs to be placed into the same component where the service executable file is. But my components are dynamically generated by heat each time the project is build. So I can't put ServiceInstall there.
Does anyone know alternative ways to install the service?
The service is .net one so my first idea would be to run installutil from .net framework directly.
I've spoken at length of the many limitations of dynamic installation authoring. What I would do is statically author this component for the service (using ServiceInstall ) and exclude it from the dynamic generation process.
Then again, I don't use dynamic authoring period. I don't consider it a best practice.
You can transform the heat output with XSLT transform (see -t switch) the way you want. And it is still better than falling back to installutil... Take a look at the DTF documentation (DTF.chm installed with WiX, Development Guide > Managed CAs > InstallUtil) for the reasons why using installutil is not considered a good idea.

How to create simple Wix setup project

We have a client/server application which includes a Windows Service and a Winform client tool. I've managed to create a Wix project in Visual Studio (2010, using the wix 3.5 toolset). I'm using the "harvest" feature on the references instead of specifying every file, because there are many library projects involved.
Problems I'm trying to figure out:
How to include referenced DLLs? Some are in the GAC, some are in a relative path within the workspace. I assume I could list each file explicitly but it seems like there should be a way for Wix to autodetect them.
How to install the service while "harvest" is enabled. All the examples I've seen require adding an explicit element with KeyPath=true. However this doesn't work with the harvest=true setting.
I realize that the harvest functionality might be a convenience which is not feasible when there are more complex things going on. Should I give up on harvesting and just try to specify each file explicitly?
Most of the examples I've seen on Wix have been just snippets of xml files. Is there anywhere I can find complete real-world examples of installing services other non-trivial setup features?
Use WixEdit. http://wixedit.sourceforge.net/
It's very easy to import an entire folder using it.
Also, check out the great WiX tutorial here: http://www.tramontana.co.hu/wix/
5.4 Services Rendered
Services can be installed and started automatically.
http://wix.tramontana.co.hu/tutorial/net-and-net/services-rendered
For even more information, check out more WiX documentation here: http://wixtoolset.org/documentation/manual

Register applications via Registry table rather than TLBs

We register the capabilities of Delphi applications using TLB files. However, from reading MSDN documentation, "Installation package authors are strongly advised against using the TypeLib table. Instead, they should register type libraries by using the Registry table". Does anyone have any advice on how to do this in a 'Delphi' way for Windows 7?
It means you would need to figure out what registry entries to add to register the tlb. This explains what needs to be done. You could also use a tool like REGCAP.EXE which comes with Visual and generates a .reg file. If you use WiX to build your msi you could use tools like tallow and heat to let them generate the wix files for you.
I'm going to answer my own question! This is a duplicate of this question, which seems to have the answer I needed (just in a different language that I would normally use).

What is the best way to install a C# windows service that doesn't require running installutil manually?

I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio setup project to do that similar to how winforms applications are installed?
I like to create a install project to get a nice and clean MSI installer, this should help you:
http://support.microsoft.com/kb/816169
And codeproject has a good example too: http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx
There are plenty of extra answers in this question.
If the app is for basic users then the MSI is the best way to go.
If it's aimed at techies then I personally prefer apps that can install and uninstall themselves, and can run as a service or like a normal app. The linked question has answers that describe this.
For completeness sakes I'll summarise http://support.microsoft.com/kb/816169 here.
You need to add a Service Installer class to your service component. This can then be called by the setup routine to add you service. You'll need to create a custom action in your Setup project to call it. The details are in the KB identified.

Resources