Page 1 of 1

Overwriting files with UAC elevation

Posted: Thu Nov 24, 2011 6:31 am
by NickDay
Hi,

IA12, Native Engine.

My installer is trying to install files in a directory under C:\Program Files.
I have these split into two groups, 'always overwrite' and 'never overwrite'.

I am finding that the 'always overwrite' group will be installed if not yet present, but are not installed if a file of the same name (different content) was already present.

The actual lines in the installer are like this:

Comment: Install 'never overwrite' files.
Set Variable NATIVE_OVERWRITE to NEVER
Install Files ... (the 'Never Overwrite' checkbox is checked)

I think this is working OK.
followed by:

Comment: Install 'always overwrite' files.
Set Variable NATIVE_OVERWRITE to ALWAYS
Install Files ... (the 'Never Overwrite' checkbox is unchecked)

It is these files which are not overwriting existing ones.
If I uninstall, they are not removed (as the installer had not installed them).
I don't know whether the checkbox on the dialog is intended to be scoped out by the variable, hence the 'belt an braces' settings.

I have tried setting the Project Settings→Project →Summary →UAC Elevation setting to either Elevate Administrators Only or Always Elevate, and have seen no difference with the above behaviour. I believe that the elevation is actually happening (in case you think a security policy is inhibiting it). At least, the elevation permission dialog is displayed.

Do you have any ideas please, or do you need further information?

Nick

Re: Overwriting files with UAC elevation

Posted: Fri Nov 25, 2011 9:08 am
by giaviv
Hi Nick,

What happens when you try this with the Windows Installer engine instead?

Re: Overwriting files with UAC elevation

Posted: Fri Nov 25, 2011 9:09 am
by giaviv
Hi Nick,

What happens when you try this with the Windows Installer engine instead?

Re: Overwriting files with UAC elevation

Posted: Fri Nov 25, 2011 10:17 am
by NickDay
Hi Aviv,
I have now overcome the problem by having my installer delete the problem files before installing them again.
If you'd still like me to try the Windows Installer I can, (let me know), but I don't think it's a good solution for me as (if I remember correctly) I'm using Native Engine facilities in this installer.
I think the original problem was due to Windows 7 permissions, with default security policies, which allow fles to be created or deleted under C:\Program Files, but not edited and resaved, or overwritten.
Nick

Re: Overwriting files with UAC elevation

Posted: Tue Dec 06, 2011 6:00 pm
by giaviv
Nick,

Just one more thing - the Windows Installer engine is more restrictive than the Native Engine in this context.
With the Native Engine you have the capability to FORCE overwrites, even if older versions of files are being installed on top of newer ones -
with Windows Installer you can NOT do this.

P.S - you can also use the NATIVE_OVERWRITE_OLDER variable in your case.