change the GUID of a components in a merge module
Hello
In my package I need to have registry keys with eg the "sourcedir" variable , order not created the tree in the registry every time, I created a merge module.
The problem is that these keys are not deleted on the uninstall, because they have alway the same GUID in the componant of my merge module.
I tried to change the GUID with a macro but it doesn't work (I think it is because componant in the merge module is not present in the table during the compilation).
is there anybody wtih have a solution ??
this is my macro
'This macro compares the current GUID of the myregistry component and changes it if it matches the template.
Dim NewGUID '..............Newly generated GUID For the myregistry component
Dim rowComponent '.........The current row In the Component table
Dim TemplateComponent '....The name of the component In the template that contains branding information
Dim TemplateGUID '.........The GUID of the component In the template that contains branding information
Dim tblComponent '.........The Component table
TemplateComponent = "myregistry" '....This needs To match the name In your template
TemplateGUID = "{9E2E442D-DCDF-4E39-A231-5AB4875CB40A}" '....This needs To match the GUID In your template
Set tblComponent = WTables("Component") '....The variable tblComponent now contains all of the Component table
For Each rowComponent In tblComponent.WRows '....This For-Loop goes through Each row In the Component table
If rowComponent("Component") = (TemplateComponent) Then '.....This looks For the myregistry Component
If rowComponent("ComponentId") = (TemplateGUID) Then '....This compares the current GUID To the template’s GUID
NewGUID = GenerateGUID() '....This generates a new GUID, placing it In the variable NewGUID
SetComponentGUID rowComponent("Component"),NewGUID '....This sets the myregistry component To the new GUID
End If
End If
Next
I'm not fully understanding
I'm not fully understanding what you want to achieve but it sounds like you want to write some custom information to the registry fromout your merge module which should be uniq to each package using the MSM.
If that is the case then just author a custom action that would write during install and remove during uninstall.
Check for permanent component
Could you check that if in Merge module you have marked it as permanent. If yes, then you have to change it.
Other thing which I will suggest you is to save the generated GUID in a property and use it to change to GUID again during uninstall action.
Not sure if this will work. You can give it a shot.
Also a more clear description might help us to give you better solution.
Piyush Nasa
Altiris Certified Professional (ACP)
My reading was that he wants
My reading was that he wants to change the GUID of a component which was installed by a merge module, presumably a third party's MM. Quite why anyone would want to do that escapes me.
@Vence, do you understand what components are and why they have a GUID?
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
hmmm
reading between the lines I read this as he has written his own merge module to deploy corporate "tagging" type info.
if that is the case merge modules are not the go for this.
use the same functions in your supplied code to write the keys into new packages.
I agree
with John. the way to go is add a feature / component combination via a macro on the Save event. This garantees that the GUID for the component will be unique. By using a macro on the Save event (Windows Installer Editor) it will be applied to both msi's and msi + mst.
Just make sure that before adding the feature / component that you check for it's existance.
Pseido code example, on the Save Event
Bool bIsOK = False
If NOT MY_Feature Then
If Add My_Feature Then
If Add My_component TO My_Feature Then
' Add your branding information to the component here
bIsOK = True
End If
End If
End If
If bIsOK <> True Then
MsgBox "Bumpits!"
End If
Cheers
Phil
Are you testing on a clean build each time?
In case none of the earlier solutions are the cause of your issues, here is one more to consider.
Just in case you are not aware of this, MSI components are reference counted - each time a particular GUID is installed, the reference count is incremented by one, if the GUID is already present in the registry. On uninstall, the reference count is decremented by one, and if it reaches zero, then the component is removed.
As you are using a merge module, the components have a fixed GUID, so the reference count is incremented at each install. If you have had any failed installs which did not roll back, or if the same merge module is used in a different project which is also installed on your test workstation, then perhaps the reason that your components are not uninstalling, is that the reference count is not decrementing to zero on uninstall.
So what you have to ensure, is that each test is carried out on a clean operating system build, or a clean virtual machine, to ensure you don't have any left over components from previous test installs on your system, which could mess up your results.
You could also enable verbose logging both for install and for uninstall, which may give you further clues as to the reason for the failure to remove the components in question.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.