cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
FighterZP
Level 3

installshield 2009 automation - File property "Always overwrite"

How can I set file property "Always overwrite" in component.

In Direct Editor -> File Table I need set 2 property on my file:
Version = 65535.0.0.0
ISAttributes = 17

I found only this available properties (С#):

ISWiAuto15.ISWiProject project = new ISWiAuto15.ISWiProject();
project.OpenProject("c:\\ism\\test04.ism", false);

ISWiComponents components = project.ISWiComponents;

foreach (ISWiComponent cmp in components)
{
ISWiFiles fls = cmp.ISWiFiles;
foreach (ISWiFile fl in fls)
{
Console.WriteLine("Name = " + fl.Name);
Console.WriteLine("DisplayName = " + fl.DisplayName);
Console.WriteLine("DynamicFile = " + fl.DynamicFile.ToString());
Console.WriteLine("FontTitle = " + fl.FontTitle);
Console.WriteLine("FullPath = " + fl.FullPath);
Console.WriteLine("get_Attributes = " + fl.get_Attributes());
Console.WriteLine("Hidden = " + fl.Hidden);
Console.WriteLine("Languages = " + fl.Languages);
Console.WriteLine("Modified = " + fl.Modified);
Console.WriteLine("OverrideSystemAttributes = " + fl.OverrideSystemAttributes);
Console.WriteLine("OverrideSystemLanguage = " + fl.OverrideSystemLanguage);
Console.WriteLine("OverrideSystemSize = " + fl.OverrideSystemSize);
Console.WriteLine("OverrideSystemVersion = " + fl.OverrideSystemVersion);
Console.WriteLine("ReadOnly = " + fl.ReadOnly);
Console.WriteLine("SelfRegister = " + fl.SelfRegister);
Console.WriteLine("ShortName = " + fl.ShortName);
Console.WriteLine("Size = " + fl.Size);
Console.WriteLine("System = " + fl.System);
Console.WriteLine("UseSystemSettings = " + fl.UseSystemSettings);
Console.WriteLine("Version = " + fl.Version);
Console.WriteLine("Vital = " + fl.Vital);
}
}
project.CloseProject();
Labels (1)
0 Kudos
(5) Replies
hidenori
Level 17

You can use the ISWiComponent.OverwriteMainOptions property in order to set the "Always overwrite" option. See the ISWiComponent Object help topic for more information.

Hope that helps.
0 Kudos
FighterZP
Level 3

ISWiComponent.OverwriteMainOptions property work only with InstallScript, InstallScript Object. My project type is BasicMSI

Found solution:

Type installerType = Type.GetTypeFromProgID("WindowsInstaller.Installer");
Installer installer = (Installer)Activator.CreateInstance(installerType);
Database database = installer.OpenDatabase("c:\\ism\\test04.ism", MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);

View view2 = database.OpenView("UPDATE File SET Version='65535.0.0.0' WHERE File='tftp.exe'");
view2.Execute(null);

View view3 = database.OpenView("UPDATE File SET ISAttributes='17' WHERE File='tftp.exe'");
view3.Execute(null);

database.Commit();
0 Kudos
hidenori
Level 17

You can also use the InstallShield automation code below for Basic MSI projects to set the Always Overwrite setting:

ISWiFile.OverrideSystemVersion = True;
ISWiFile.Version = "65535.0.0.0";


I filed the work order #IOA-000057647 so that the InstallShield automation interface will support the ISWiFile.AlwaysOverwrite property in a future release.
0 Kudos
nhenny2008
Level 3

How do I do this if I am using DynamicFileLinking in a basic MSI project?:confused:
0 Kudos
operaza
Level 4

You get to set OverwriteMainOptions to 1 instead of 4 so it works as the option #4 per installshield 2011 help files. (when using the automation object to create installscript projects)
0 Kudos