/build/static/layout/Breadcrumb_cap_w.png

Changing KeyPath to "" for a set of files, safe?

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

Answers (7)

Posted by: AngelD 14 years ago
Red Belt
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.
Posted by: timmsie 14 years ago
Fourth Degree Brown Belt
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)
Posted by: AngelD 14 years ago
Red Belt
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).
Posted by: jmcfadyen 14 years ago
5th Degree Black Belt
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
Posted by: jimbush 14 years ago
Yellow Belt
0
Thanks to you both for your advice.

Jim
Posted by: MSIPackager 14 years ago
3rd Degree Black Belt
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 [:)]
Posted by: jimbush 14 years ago
Yellow Belt
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...
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ