Showing posts with label InstallShield. Show all posts
Showing posts with label InstallShield. Show all posts

Friday, July 17, 2009

InstallShield Setup Prerequisites for PIA 2003, PIA 2007, VSOT, .NET2.0

Now, if you are writing an "InstallShield X" package for something like an Excel Addin, you are dependent on a number of things:
  • .NET Framework (2.0, for example, dotnetfx2.0.exe)
  • Office 2007 Primary Interop Assemblies (o2007pia.msi)
  • Visual Studio Tools for Office (vstor2005.exe)
One way to do this is setting up a "Basic MSI Project" (NOTE: this doesn't work with a standard InstallShield project as pre-requisites are not supported there !!)
and add prerequisites (Tools->Prerequisite Editor) for each of these dependencies.
Now the crucial question is, which condition to set for each of these packages ?
Here's my best solution, so far (Conditions tab in Preqrequisites):
  • .NET Framework 2.0: "A File does or does not exist" [WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe --- Run setup if: Not Found
  • PIA Office 2007: "A registry key does or does not exist" HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{50120000-1105-0000-0000-0000000FF1CE} --- Run setup if: Not Found
  • PIA Office 2003: "A registry key does or does not exist" HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{91490409-6000-11D3-8CFE-0150048383C9} --- Run setup if: Not Found
  • Visual Studio 2005 Office Tools: "A registry key does or does not exist" HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{388E4B09-3E71-4649-8921-F44A3A2954A7} --- Run setup if: Not Found
Took me a long time to figure these out, thanks Anthony ! Would be nice if this helps someone :-)

Wednesday, July 15, 2009

InstallShield and Windows Services: ServiceExistsService doesn't work

So for me, ServiceExistsService didn't work at all.
There are some permission issues apparently (see http://community.acresso.com/archive/index.php?t-169135.html)
but the solution proposed there is a tad too heavy-weight for me.
Here's an alternative, use the Registry entry of a service to figure out if the service is installed or not:
// Indicates if the service with this key (e.g. myNewService) has been installed
function BOOL windowsServiceExists(serviceKey)
string szKey,szServiceName;
number nRootKey;
begin
nRootKey = HKEY_LOCAL_MACHINE;
if (RegDBSetDefaultRoot (nRootKey) <>
MessageBox ("Unable to set HKEY_LOCAL_MACHINE.", SEVERE);
return FALSE;
endif;
szKey = "SYSTEM\\CurrentControlSet\\Services\\" + serviceKey;
//MessageBox("Testing for service: " + serviceKey, INFORMATION);
if (RegDBKeyExist (szKey) = 1 )
then
//MessageBox("found service:" + szServiceName, INFORMATION);
return TRUE;
endif;
return FALSE;
end;

How to suppress InstallShield warning W7503

If you are like me and don't like duplication you might have something like a common.rul file that contains common methods. But with the InstallShield (7.x and higher ?) compiler you get this warning if you didn't use a method:
W7503: function defined but never called
Bad thing about this is the fact that you can't easily spot real warnings from this 'warning to ignore'.
Here's how to avoid this:
1) define a dummy method where you call all your offending methods
// dummy function to supress warning 'function defined but never called'
prototype dummySuppressWarningW7503();
function dummySuppressWarningW7503()
begin
setRegistryValue("","",0,"");
end;
2) call this method someplace that is definitely executed inside an if( FALSE ):
// a little trick to stop the compiler from showing warnings
if( FALSE ) then
dummySuppressWarningW7503();
endif;
Tada ! The compiler thinks its called, but it never is.