cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mescalero
Level 7

Problems with Multi-instance functionality

Hello All,

I have a couple of problems when using the multi-instance functionality with a Basic MSI installation:

1) to differentiate the service display names for my multi-instance app in Services, I'm using " [InstanceId]" in the Display Name field for defining the service. The first time, this works fine, as the InstanceId property populates the name: " 0". However, when I install a second instance, " 1" overwrites the first instance name.

2) The [InstanceId] property apparently does not get resolved in time to display in the status boxes, Add/Remove programs, etc. (One sees the actual property [InstanceId] appended to the Product Name.) Is there a way to resolve this property earlier in the installation?

I should mention that I'm using the [InstanceId] property because the number of instances installed to a machine is indeterminate--defining a set number of instances in the Multiple Instances view isn't an option.

I could get round 2) by defining some number of instances that no user is likely to install. Surely there's a way to resolve the first problem? Thanks to anyone who has dealt with this or knows of a fix.
Labels (1)
0 Kudos

(11) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

For the service, the Name field would also need to use the instance ID. Otherwise, the internal name of the service will be identical to the existing service, and it will then update that one. (Note that field is the tree item label in the Services for a component.)

For your second issue, properties are resolved at whatever point they are referenced. Note that you cannot embed one property reference ([PropertyName]) as the value of another property, such as the ProductName property. Any properties present in the property table are not resolved by Windows Installer to avoid circular property references (see http://msdn.microsoft.com/en-us/library/aa370908(VS.85).aspx). If you need to set one property that is in the property table with the value of another property, a set property custom action would be needed to resolve any embedded properties. In the case of updating the ProductName property, a set property custom action can be created with the following information:
Property Name: ProductName
Property Value: My Product Name - [InstanceId]

This would need to be sequenced early in the install UI and install execute sequences because a property like ProductName is private and will not have its value passed from the UI to execute sequence.
0 Kudos
Mescalero
Level 7

Josh,

On the first issue, I'm confused: the name field that you refer to, it is the name one gives the service under Component > Advanced Settings > Services > Service Name? I can't enter spaces or the brackets for a property name in that case...

Thanks for your explanation on the second point.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

You can edit the service internal name directly in the Name columns of ServiceInstall and ServiceControl tables (these names must match between tables) from the Direct Editor if spaces in the internal service name are necessary. Otherwise, a name such as 'myservice[InstanceId]' should work fine when renaming the service in the Components view.
0 Kudos
Mescalero
Level 7

Great, directly editing the tables did the trick.

Josh, many thanks for your help.
0 Kudos
ccRubens
Level 5

Hi joshstechnij,

By the answer u give in here i was able to fix a major problem for many ppl, tank u very much, but before make a release of this multi - instances - services i need to ensure that everything works flowless :D, but i m having problems with the uninstall, basically doesn´t work.

I was having 1 Service and install and uninstall perfect, now i add the multi-instance ability and the uninstall give the message "Esta accion solo es valida para los productos que estan instalados actualmente"(This action is not valid for the products that are currently installed) after uninstalling the "Service1" and trying to uninstall the second.
But "Service1" and "Service2" remaing in the Windows Services control panel and the his directorys.

Tnks in advance.
0 Kudos
Mescalero
Level 7

Hi,

What I did to get the services to uninstall is to set a Condition for the component that installs/uninstalls your service. So, for example, in the case of the first instance, use "InstanceId=0" in the "Condition" field for that component; "InstanceId=1" for the second instance, etc. (I defined a component for each instance of my service. A bit tedious, yes, but I am not sure that there is another way to do it.)

Doing this allows the instances to uninstall from SCM.
0 Kudos
ccRubens
Level 5

Mmm,

So basically u are using the Multiple Instances option like a smoke screen for wshowing the capability for installing instances, but under surface u are using diferent component.... waky :D, nice.

I will some more test later, but now is the installing the one with problems, i make 2 components pointing the same "Service.exe" the first key name is "Service.exe" the second one i have to changed to "Service1.exe" because is a key and can´t have the same name, but is refering "Service.exe".

Question... U make another Service.exe and change its name?¿, i assuming u did, but i dont Know if is gonna work..., if not, what did u do?¿, only make a new component and reference the same Service, and doesn´t give u any trouble?¿

Tanks
0 Kudos
Mescalero
Level 7

Hi Ruben,

I am indeed changing the service name, using the [InstanceId] property to differentiate the names in Services.

So under "Advanced Settings > Services" for that file component, I define it as " [InstanceId]". After these get installed, they will thus appear as " 0", " 1", etc in the SCM.

If you want your service name to contain spaces (which you very likely do), then you will need to specify the names in the ServiceControl and ServiceInstall tables in the Direct Editor. (The Services node under Advanced settings does not allow one to enter spaces directly. Not sure why since the tables can be fiddled to allow it.) 😄
0 Kudos
Mescalero
Level 7

I forgot to add: yes, I create a component for each service instance. It's a bit tedious to set up if you have several instances, and not terribly elegant, but hey, it works! 🙂
0 Kudos
ccRubens
Level 5

Mascalero.

Men tanks for ur help, i apreciate.

The "Trick" with the "InstanceId" i know from other post, but in this case i am not using it, well because if i have to define "manualy" each service, then i can use the name i wanna :D, not one with a secuencial number .

The part of changing the name of the service was because i tought that i need to change the name of the referenced service, the ".exe", according to the name of my service, but i probe that this was wrong :D.

Anyway... i was able to put this "multi instances service" moving, mainly because of this post. Tanks
0 Kudos
Mescalero
Level 7

Glad you've got it working!
0 Kudos