Hi, my MSI (created by a Visual Studio setup project) installs files that I expect to be changed/deleted later by a user. This means that the self heal kicks in after a deletion and puts the file back.

I don't want that, so after some hours of research, I found that I could stop this by running a simple script on the MSI

//Find Components that are under my special directory, and set their KeyPath to ""

var sqlSelect = "SELECT `Condition`, `KeyPath`, `DefaultDir` FROM `Component`, `Directory` WHERE `Component`.`Directory_` = `Directory`.`Directory`";


view = database.OpenView(sqlSelect);
view.Execute();
record = view.Fetch();
while (record)
{
condition = record.StringData(1);
keyPath = record.StringData(2);
dir = record.StringData(3);
if(dir.indexOf("aDirectoryOfInterest")>-1){

record.StringData(2)="";
view.Modify(msiViewModifyUpdate, record);

}

record = view.Fetch();
}

view.Close();
database.Commit();

in my limited test it seems to work. However, I'm far from an expert on MSI's, so I'm wondering if it's safe to do this? Or is there a better way?

The VS Setup Project interface is quite limited, so I tend to have to do advanced stuff like this with scripts after the MSI has been built.

Thanks in advance
Jim
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

1
For a component holding the files, registry & other resources not to be reinstalled during a self-healing/repair process you need to remove the ComponentId column value for that component from the Component table.

Have in mind that any resources installed by that component will not be removed during an uninstall.
Answered 01/25/2010 by: AngelD
Red Belt

Please log in to comment
1
You could create a new top level feature and add the components you dont want repaired to this.
As long as the feature is at the top of the tree and contains no entry points i.e shortcuts, extensions etc etc it wont get repaired.

I don't know the structure of the msi but I'm guesing one feature....

So it would look like this:
Feature
Components


You want:
Feature
Components
New Feature
Components (you dont want repaired)
Answered 01/26/2010 by: timmsie
Fourth Degree Brown Belt

Please log in to comment
1
Nice tip timmsie,

However; this would only work for non-user related resources (files), same goes with my reply.
The "user profile-fix" healing would not add the files the first time the user launches the applications (calls an entrypoint for the application, ex. advertised shortcut).

If these files are located in the user's profile then add the files to a component(s) and set a HKCU registry entry as keypath would just add the files during the "user profile-fix" (first launch) and not repair them back (if the files are missing) as the keypath is still intact (if not also removed/deleted).
Answered 01/26/2010 by: AngelD
Red Belt

Please log in to comment
0
Thanks to you both for your advice.

Jim
Answered 01/26/2010 by: jimbush
Yellow Belt

Please log in to comment
0
If these files are located in the user's profile then add the files to a component(s) and set a HKCU registry entry as keypath would just add the files during the "user profile-fix" (first launch) and not repair them back (if the files are missing) as the keypath is still intact (if not also removed/deleted).

Of course, validating the MSI would tell you to do that [:)]
Answered 01/27/2010 by: MSIPackager
Third Degree Black Belt

Please log in to comment
1
throw away the setup project and get into WiX.

vs setup is the most horrible useless waste of space MS has released. if you need guidance with WiX I/we can help out there. Get a copy of Votive which allows a seemless integration into VS compilation in a similar way to how the setup project works.

WiX offers a much cleaner alternative
Answered 01/28/2010 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
Thanks for the suggestion, yes I looked at wix a while ago, but was scared off by the thought of manually adding my hundreds of files to the XML.

I mean, do I have to write an XML entry for every file (most of my files have a Condition attached)? I guessing you can probably specify entire directories instead?

Basically I've got a large setup project that is just doing the job, and don't want to endure a lot of pain to switch...
Answered 02/01/2010 by: jimbush
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity