Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Install component during repair


2 replies to this topic

TonyLowrey

TonyLowrey
  • Members
  • 15 posts

Posted 18 January 2006 - 17:20

I have a merge module which installs up to 6 files if they do not already exists. I use a condition on the component to only install if the file does not already exist. When I list the component states using:
WiLstPrd.vbs "TestApp" c
it shows the components installed and shows the others as not installed and with no path. So far so good!

The problem is with repair! If I delete a file which was installed then repair replaces it. If I delete a file which already existed then repair does not install the component containing the file automatically.

Therefore I wrote a Custom Action to check the component state using
session.ComponentCurrentState("CompName")
and tried to set the state using
session.ComponentRequestState("CompName") = 3
during repair and scheduled just before InstallValidate.

Problem is that the current states for the 6 files all show installed (3) even though they are not all installed. Also the session.ComponentRequestState("CompName") = 3 errors with:

MSI (s) (A4!F8) [14:16:08:562]: Note: 1: 2262 2: IsolatedComponent 3: -2147287038
MSI (s) (A4!F8) [14:16:08:562]: Note: 1: 2262 2: BindImage 3: -2147287038

Ideas?

All I want is a way to install a component during repair which was, on a condition, not installed during the install.


TonyLowrey

TonyLowrey
  • Members
  • 15 posts

Posted 19 January 2006 - 14:28

More info:
The Custom Action which changes the state has been moved to after InstallValidate as MS docs indicate.

I have done more testing of the CA during install rather than repair and have shown that switching off a component by:
sesssion.ComponentRequestState("CompName") = 2
actually does work and does not install the file if it was otherwise being installed.

However the opposite, switching on a component:
sesssion.ComponentRequestState("CompName") = 3
reports the error even during install for a component which was not going to be installed.

So this behaviour is nothing to do with the repair function.

Has anyone got a CA which changes Component state to install from not to be installed that works?

TonyLowrey

TonyLowrey
  • Members
  • 15 posts

Posted 19 January 2006 - 18:16

Success!

I have got a working Custom Action at last.

Setting Component Install-State to "Install Local" cannot be done if the component has a False condition.

I solved the problem by removing the component conditions (blank) and running my Execute CA after InstallValidate to either setting the install state using:
session.ComponentRequestState("ComponentName") = 3 (for local install)
or
session.ComponentRequestState("ComponentName") = 2 to leave alone if not installed.

The code looks like:

CODE
' CompInstall is True if the component is to be installed

ComponentInstalledState = Session.ComponentCurrentState(ComponentName)

if Session.Property("REMOVE") <> "ALL" Then ' skip if uninstall
  if CompInstall = True then
     Session.ComponentRequestState(ComponentName) = 3 ' install
  else
     if ComponentInstalledState = 2 Then ' If not installed then do nothing
        Session.ComponentRequestState(ComponentName) = 2 ' Don't Install
     end if
  end if
end if


This works during install when the current state values ComponentInstalledState = 2 meaning not installed and during repair the ComponentInstalledState = 3 meaning installed. If the file is installed and doesn't need installing then the state stays as 3. If the component needs installing then the state is set as 3.