MSI TRansaction clarification

Got a problem you cannot solve? Try here.
Post Reply
anja_laenge
Posts: 131
Joined: Tue Nov 20, 2012 1:02 am

MSI TRansaction clarification

Post by anja_laenge »

Hi,

I need some clarification concerning MSI transactions and rollback functionality...

My current IA project does the following:
- check for an older version installed via WISE Installer using the AxoNet plugin and remove if found
- check for a named sql2005 instance and remove it via MSI uninstall via it's productcode from the registry
- install sql2008 express instance
- move database mdf/ldf files (sqldataroot paths determined from registry)
- attach database files

In case of a fresh installation
- install sql2008 express instance
- copy bak file to sqldataroot
- restore database

My question regarding the MSI transactions:
Which of theses actions will be affected by a rollback?
Where do I need to implement which commands to make the uninstalation of the previous version be affected by the rollback?
If so(previous version affected by rollback) which other of the listed actions will be affected?

And finally: Do you have a small example snippet illustrating the syntax and where to place the commands?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: MSI TRansaction clarification

Post by FrancescoT »

Dear Anja,

With MSI trasaction all MSI database operation that are within a BEGIN & COMMIT Transaction can be rolled back.
MSI transaction can be executed only within the process where the MSI is running. In other words, it only works for the MSI database where the transaction is started and transactions can't be nested because Windows Installer does not allow this.

Trasaction can rollback any command that is part of the current windows installer database but can't rollback an action that it is executed outside of it.
For example, those command that are not part of Windows Installer commands (Purple Commands) and generally those that are part of Direct Execute command.

Code: Select all

  Set Variable MYMSITRANSACTION to FALSE
  MSI Transaction : Begin New Transaction (get result into variable MYMSITRANSACTION)
  MessageBox: Debug, MYMSITRANSACTION = $MYMSITRANSACTION$$NEWLINE$$NEWLINE$
   
  ...  Do Something .....

  Comment: End MSI Transaction
  Set Variable DOROLLBACK to FALSE
  MessageBox: Debug, Do you want to roolback?$NEWLINE$$NEWLINE$
  if Variable DOROLLBACK Equals YES
    MSI Transaction : Discard Changes (get result into variable MYMSITRANSACTION)
    MessageBox: Debug, MYMSITRANSACTION = $MYMSITRANSACTION$$NEWLINE$$NEWLINE$
    Terminate Installation
  end

  MSI Transaction : Commit Changes (get result into variable MYMSITRANSACTION)
  MessageBox: Debug, MYMSITRANSACTION = $MYMSITRANSACTION$$NEWLINE$$NEWLINE$

Hope this helps you.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
anja_laenge
Posts: 131
Joined: Tue Nov 20, 2012 1:02 am

Re: MSI TRansaction clarification

Post by anja_laenge »

Hello Francesco,

it does help! Thank you.
Another question regarding the uninstall process:

in the scenario described in my post, I don't understand the behavior during uninstallation:
When I have installed the previous version (via WISE) and install my new version (via IA) I cannot perform a correct uninstall.
The program icon disappears from the desktop but appears again. The files in the target directory are not deleted, also the program is still listed in the system control and an anew call of the setuo starts in maintenance mode again.
Same when I install the IA version without prior WISE install of the previous version.

I've build a small testsetup to check the behavior with a new project, not customized by me - and it works correctly. But I cannot find a difference in the areas concerning uninstall and defining items to be affected by uninstall.
What things can cause this behavior?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: MSI TRansaction clarification

Post by FrancescoT »

Dear Anja,

It is not easy to give you a correct answer without having your code.
I can only suppose that exist something wrong with the way you used to remove your Wise package... probably.

Could you post a sample project that replicate your issue?

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
anja_laenge
Posts: 131
Joined: Tue Nov 20, 2012 1:02 am

Re: MSI TRansaction clarification

Post by anja_laenge »

FrancescoT wrote: It is not easy to give you a correct answer without having your code.
I can only suppose that exist something wrong with the way you used to remove your Wise package... probably.

Could you post a sample project that replicate your issue?
Okay, this is the mpr copied as text. Please note that any sensitive information is replaced with dummy values.

Code: Select all

Comment: Native Code Setup Engine 32 bit-64 bit Installer Project
 
[DEFINE REGION: Check Application Requirements]
Get System Setting Windows XP into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least Windows XP.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
<<Code Folding Region>>
 
[DEFINE REGION: Check/Install Application Pre-Requisites]
 
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to 
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
  Comment: Uninstall via Windows Installer
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
Include Script: checkie6
Include Script: checkmsi45
Include Script: checkmdac28
Include Script: checknet2sp2
Include Script: checkmsxml60
Include Script: checknet30
Include Script: checknet3sp2
Include Script: checknet351
Include Script: checksql2008
if Variable RECOMMENDEDUPGRADE Equals TRUE
  Comment: Uninstall via Native Engine
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Removal
end
[compiler end]
<<Code Folding Region>>
 
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
  Comment: Display Dialog: prereq, wait for dialog to return (modal)
  if Variable WIZARD Equals CANCEL
    Terminate Installation
  end
  Display Dialog: progressprereq, use as progress dialog (non-modal)
  [compiler if Variable BUILDMODE not Equals PATCH]
  if Variable NEEDSUPGRADE Equals TRUE
    Set Variable REMOVEOLD to 
    Set Variable ERROROLD to 
    Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
    if Variable REMOVEOLD Equals ERROR
      MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs 
before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
      Terminate Installation
    end
    if Variable REMOVEOLD Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in 

all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, 

setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
        else
        Terminate Installation
      end
    end
    Set Variable MAINTENANCE to FALSE
  end
  [DEFINE WEB MEDIA Microsoft Internet Explorer 6 with Service Pack 1]
  Include Script: setupie6
  [DEFINE WEB MEDIA Microsoft Windows Installer 4.5]
  Include Script: setupmsi45
  [DEFINE WEB MEDIA Microsoft MDAC Refresh 2.8]
  Include Script: setupmdac28
  [DEFINE WEB MEDIA Microsoft .NET Framework 2.0 with Service Pack 2]
  Include Script: setupnet2sp2
  [DEFINE WEB MEDIA Microsoft XML Parser 6.0]
  Include Script: setupmsxml60
  [DEFINE WEB MEDIA Microsoft .NET Framework 3.0]
  Include Script: setupnet30
  [DEFINE WEB MEDIA Microsoft .NET Framework 3.0 Service Pack 2]
  Include Script: setupnet3sp2
  [DEFINE WEB MEDIA Microsoft .NET Framework 3.5 with Service Pack 1]
  Include Script: setupnet351
  if Variable RECOMMENDEDUPGRADE Equals TRUE
    Comment: Bind to external setup log
    Set Variable NATIVE_LOGGING to $NATIVE_OLDLOG$
    Set Variable NATIVE_ENGINE_MODE to $NATIVE_ENGINE$
    Set Variable NATIVE_ENGINE to TRUE
    Apply Uninstall (get result into variable NATIVE_UNINSTALL)
    Set Variable NATIVE_ENGINE to $NATIVE_ENGINE_MODE$
    if Variable NATIVE_UNINSTALL Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in 
all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, 

setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
        else
        Terminate Installation
      end
      else
      if Variable NATIVE_UNINSTALL not Equals COMPLETE
        MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. It is strongly recommended that you uninstall it yourself using 

Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$LASTERROR$$NEWLINE$$NEWLINE$Click OK to quit $TITLE$ 

Setup.$NEWLINE$$NEWLINE$Click Cancel to continue $TITLE$ Setup anyways (not recommended).
        if Variable NATIVE_ERROR Equals OK
          Terminate Installation
        end
      end
    end
    Comment: Bind to internal setup log
    Set Variable NATIVE_LOGGING to 
  end
  [compiler end]
  Hide Dialog
end
<<Code Folding Region>>
 
<<Code Folding Region>>
 
[DEFINE REGION: Define Setup Globals]
Comment: Define Setup Components
Define Component: Client
Define Component: Database
 
Comment: Initialize Setup Globals
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Get System Setting Windows NT Kernel (NT4, 2000, XP, 2003, Vista, 2008, 7, 2008 R2, 8, 2012) into ISNT
Get Folder Location System->Program Files Directory into PROGRAMFILES
Get Common Folder Location System->Program Files Directory into COMMONFILES
Get Common Folder Location Start Menu->Programs Group into SHORTCUTFILESALL
Get Folder Location Start Menu->Programs Group into SHORTCUTFILES
if Variable SHORTCUTFILESALL Equals 
  Set Variable SHORTCUTFILESALL to $SHORTCUTFILES$
end
Get Folder Location System->Desktop Directory into DESKTOPDIR
Get Folder Location System->Windows Directory into WINDIR
Get Folder Location System->System Directory into SYSTEM32
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
Get Folder Location System->System Directory into SYSWOW64
Get Folder Location System->Program Files Directory into PROGRAMFILES_X86
Get Common Folder Location System->Program Files Directory into COMMONFILES_X86
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Get Folder Location Taskbar->Quick Launch Directory into QUICKLAUNCHDIR
Get Folder Location WWW->WWWRoot into WWWROOTDIR
<<Code Folding Region>>
 
[DEFINE REGION: Setup User Interview]
if Variable MAINTENANCE Equals TRUE
  GoTo Label: Maintenance
  else
  [compiler if Variable BUILDMODE not Equals PATCH]
  Comment: First Time Install
  Set Variable TARGETDIR to $PROGRAMFILES$\company\$TITLE$
  Set Persistent Variable TARGETDIR_X86 to $PROGRAMFILES_X86$\$TITLE$
  Set Variable STARTMENU to company Software\$TITLE$
  Set Variable NATIVE_ENGINE to TRUE
  [compiler end]
end
 
label: Welcome Dialog
Display Dialog: welcome, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
  GoTo Label: Main Install
end
[compiler if Variable BUILDMODE not Equals PATCH]
label: License Check
Display Dialog: licensecheck, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Welcome Dialog
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: ReadMe Information
 
label: Setup Type
Display Dialog: setuptype, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: User Registration
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
if Variable MINIMUM Equals TRUE
  Select Component: Client
  Deselect Component: Database
  else
  if Variable COMPLETE Equals TRUE
    Select Component: Database
    Select Component: Client
  end
  else
  if Variable PERSONALIZED Equals TRUE
    Select Component: Database
    Select Component: Client
  end
end
[DEFINE REGION: Initialize Variables]
 
Set Variable SQLINSTANCE to myinstance
Set Variable SQLDBNAME to mydbname
Set Variable SQLUSER to sa
Set Variable SQLPASSWORD to mypassword
Set Variable SQLSERVER to 
 
 
Set Variable IS_CUSTOM_INSTALL to FALSE
Set Variable product_CONNECTION_FOUND to 
 
Comment: MessageBox: debug, sqlinstance: $SQLINSTANCE$ $NEWLINE$sqldbname: $SQLDBNAME$$NEWLINE$sqluser: $SQLUSER$$NEWLINE$sqlpassword: 
$SQLPASSWORD$$NEWLINE$iscustominstall: $IS_CUSTOM_INSTALL$$NEWLINE$product connection found: $product_CONNECTION_FOUND$
 
Comment: ---------------------------------------------------------------------------------------------------
Check Registry Key HKCU\Software\company\product\Connection\ into product_CONNECTION_FOUND
if Variable product_CONNECTION_FOUND not Equals NO$KEY
  Set Variable SQLSERVER_COMPLETE to 
  Read Registry Key HKCU\Software\company\product\Connection\SQLServer into SQLSERVER_COMPLETE
  Parse String $SQLSERVER_COMPLETE$ into Variables SQLSERVER and SQLINSTANCE (Split at first occurrence of pattern)
  Read Registry Key HKCU\Software\company\product\Connection\SQLDataBase into SQLDBNAME
  Read Registry Key HKCU\Software\company\product\Connection\SQLPWD into SQLPASSWORD
  Read Registry Key HKCU\Software\company\product\Connection\SQLUser into SQLUSER
  Evaluate Expression $SQLINSTANCE$ <> "myinstance" and $SQLDBNAME$ <> "mydbname" into variable IS_CUSTOM_INSTALL
end
 
Comment: MessageBox: debug, sqlinstance: $SQLINSTANCE$ $NEWLINE$sqldbname: $SQLDBNAME$$NEWLINE$sqluser: $SQLUSER$$NEWLINE$sqlpassword: 
$SQLPASSWORD$$NEWLINE$iscustominstall: $IS_CUSTOM_INSTALL$$NEWLINE$product connection found: $product_CONNECTION_FOUND$
 
Set Variable USE_ENUMERATED_INSTANCE to 
Set Variable INSTALL_NEW_INSTANCE to 
<<Code Folding Region>>
label: Custom Setup
Display Dialog: wizsqlinstance (if variable PERSONALIZED is TRUE), wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Setup Type
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
 
Comment: MessageBox: debug, sqlinstance: $SQLINSTANCE$$NEWLINE$sqldbname: $SQLDBNAME$$NEWLINE$sqluser: $SQLUSER$$NEWLINE$sqlpassword: $SQLPASSWORD
$$NEWLINE$iscustominstall: $IS_CUSTOM_INSTALL$$NEWLINE$product connection found: $product_CONNECTION_FOUND$

Comment: MessageBox: debug, servicename: $SERVICENAME$ $NEWLINE$requested instance found: $REQUESTEDINSTANCE_FOUND$$NEWLINE$installnewinstance: 
$INSTALL_NEW_INSTANCE$$NEWLINE$useenumeratedinstance: $USE_ENUMERATED_INSTANCE$$NEWLINE$databasetest: $DATABASETEST$
 
Comment: ---------------------------------------------------------------------------------------------------
Set Variable SERVICENAME to MSSQL$$SQLINSTANCE$
Set Variable REQUESTEDINSTANCE_FOUND to 
Check Service State for $SERVICENAME$ (write result into variable REQUESTEDINSTANCE_FOUND)
Comment: validate custom settings
if Variable INSTALL_NEW_INSTANCE Equals TRUE
  if Variable REQUESTEDINSTANCE_FOUND not Equals NOTINSTALLED
    MessageBox: SQL Server, Eine Instanz mit dem Namen $SQLINSTANCE$ existiert bereits. Bitte geben Sie einen anderen Namen für die neu zu 
erstellende Instanz an.
    GoTo Label: Custom Setup
  end
end
if Variable USE_ENUMERATED_INSTANCE Equals TRUE
  if Variable REQUESTEDINSTANCE_FOUND not Equals RUNNING
    MessageBox: SQL Server, Eine Instanz mit dem Namen $SQLINSTANCE$ wurde nicht gefunden. Bitte verwenden Sie eine vorhandene und aktive Instanz.
    GoTo Label: Custom Setup
  end
  if Variable REQUESTEDINSTANCE_FOUND Equals RUNNING
    Set Variable DATABASETEST to 
    Microsoft SQL Server Script : Connect to database $SQLDBNAME$ on instance .\$SQLINSTANCE$ as user $SQLUSER$ (get result into variable DATABASETEST)
    if Variable DATABASETEST Equals SUCCESS
      MessageBox: SQL Server, In der Instanz $SQLINSTANCE$ existiert bereits eine Datenbank mit dem Namen $SQLDBNAME$. Bitte passen Sie Ihre 
Einstellungen an.
      GoTo Label: Custom Setup
    end
  end
end
 
Comment: MessageBox: debug, servicename: $SERVICENAME$ $NEWLINE$requested instance found: $REQUESTEDINSTANCE_FOUND$$NEWLINE$installnewinstance: 
$INSTALL_NEW_INSTANCE$$NEWLINE$useenumeratedinstance: $USE_ENUMERATED_INSTANCE$$NEWLINE$databasetest: $DATABASETEST$
 
label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Custom Setup
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Start Menu
Display Dialog: startmenu, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Destination Directory
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
[compiler end]
label: Start Installation
Display Dialog: startinstallation, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  [compiler if Variable BUILDMODE not Equals PATCH]
  GoTo Label: Start Menu
  [compiler else]
  GoTo Label: Welcome Dialog
  [compiler end]
  else
  GoTo Label: Main Install
end
 
label: Maintenance
Comment: Maintenance Install/Uninstall
wizard loop
  Display Dialog: maintenance, wait for dialog to return (modal)
  Display Dialog: componentstree (if variable MODIFY is TRUE), wait for dialog to return (modal)
  Display Dialog: startinstallation, wait for dialog to return (modal)
end
<<Code Folding Region>>
 
[DEFINE REGION: Process (Un)Installation]
label: Main Install
Comment: Exit Setup if Wizard Loop cancelled
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
 
Comment: Prepare to install
Set Variable PROGRESSTEXT to Installing $TITLE$
Set Variable SUCCESS to 
Set Variable LASTERROR to 
if Variable ALLUSERS Equals TRUE
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILESALL$\$STARTMENU$
  else
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILES$\$STARTMENU$
end
Display Dialog: progress, use as progress dialog (non-modal)
 
Comment: Modify Target System
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Apply Uninstall (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
  else
end
<<Code Folding Region>>
[DEFINE REGION: Perform First Time or Maintenance Installation]
if Variable NATIVE_ENGINE Equals TRUE
  if Variable MAINTENANCE Equals TRUE
    if Variable MODIFY Equals TRUE
      Comment: Facilitate removal of deselected setup features
      Apply Uninstall (get result into variable SUCCESS)
      if Variable SUCCESS Equals CANCEL
        Terminate Installation
      end
    end
    if Variable REPAIR Equals TRUE
      Comment: Prevent rollback when repairing existing installation
      Set Variable NATIVE_ROLLBACK to FALSE
    end
  end
end
Comment: Install/Re-Install product
Create Shortcut $SHORTCUTFOLDER$\Uninstall #TITLE# to $UNINSTALLLINK$
 
Set Variable PRODCODE to 
Comment: Old Guid from WiseProject's Distribution Page
Get Product Code from Upgrade Code {MyOldWiseGuid} into PRODCODE
 
[OFFLINE CONTENT]
[DEFINE WEB MEDIA Database]
Get Component Database Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
  Comment: ---------------------------------------------------------------------------------------------------
   
  Comment: MessageBox: debug, oldsqlproductcode: $OLDSQLPRODUCTCODE$ $NEWLINE$oldsqldataroot: $OLDSQLDATAROOT$$NEWLINE$olddbinstanceregpath: 
$OLDDBINSTANCEREGPATH$$NEWLINE$newsqlproductcode: $NEWSQLPRODUCTCODE$$NEWLINE$newsqldataroot: $NEWSQLDATAROOT$$NEWLINE$newdbinstanceregpath: 
$NEWDBINSTANCEREGPATH$$NEWLINE$db2008target: $DB2008TARGET$$NEWLINE$source: $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.*$NEWLINE$$NEWLINE$
   
  if Variable PRODCODE not Equals 
    Comment: prodcode existiert -> upgrade
    if Variable IS_CUSTOM_INSTALL Equals FALSE
      Comment: get sql2005 prodcode from registry and remove 2005 instance
      Set Variable OLDSQLPRODUCTCODE to 
      Set Variable OLDSQLDATAROOT to 
      Set Variable OLDDBINSTANCEREGPATH to 
      Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL\$SQLINSTANCE$ into OLDDBINSTANCEREGPATH
      Set Variable OLDDBREGPATHFORPRODUCTCODE to SOFTWARE\Microsoft\Microsoft SQL Server\$OLDDBINSTANCEREGPATH$\Setup
      Read Registry Key HKLM\$OLDDBREGPATHFORPRODUCTCODE$\ProductCode into OLDSQLPRODUCTCODE
      Read Registry Key HKLM\$OLDDBREGPATHFORPRODUCTCODE$\SQLDataRoot into OLDSQLDATAROOT
       
      Comment: MessageBox: debug, oldsqlproductcode: $OLDSQLPRODUCTCODE$ $NEWLINE$oldsqldataroot: $OLDSQLDATAROOT$$NEWLINE$olddbinstanceregpath: 
$OLDDBINSTANCEREGPATH$$NEWLINE$newsqlproductcode: $NEWSQLPRODUCTCODE$$NEWLINE$newsqldataroot: $NEWSQLDATAROOT$$NEWLINE$newdbinstanceregpath: 
$NEWDBINSTANCEREGPATH$$NEWLINE$db2008target: $DB2008TARGET$$NEWLINE$source: $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.*$NEWLINE$$NEWLINE$
       
      Install/Remove MSI Package $OLDSQLPRODUCTCODE$[REMOVE=ALL]
      Include Script: setupsql2008
      Run Program sc config SQLBrowser start= auto (WAIT)
      Run Program sc start SQLBrowser (WAIT)
      Set Variable NEWSQLPRODUCTCODE to 
      Set Variable NEWSQLDATAROOT to 
      Set Variable NEWDBINSTANCEREGPATH to 
      Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL\$SQLINSTANCE$ into NEWDBINSTANCEREGPATH
      Set Variable NEWDBREGPATHFORPRODUCTCODE to SOFTWARE\Microsoft\Microsoft SQL Server\$NEWDBINSTANCEREGPATH$\Setup
      Read Registry Key HKLM\$NEWDBREGPATHFORPRODUCTCODE$\ProductCode into NEWSQLPRODUCTCODE
      Read Registry Key HKLM\$NEWDBREGPATHFORPRODUCTCODE$\SQLDataRoot into NEWSQLDATAROOT
      Set Variable DB2008TARGET to $NEWSQLDATAROOT$\DATA
      Move Local Files $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.* to $DB2008TARGET$    
      Microsoft SQL Server Script : Connect to database master on instance .\$SQLINSTANCE$ as user sa
      Microsoft SQL Server Script : Connect to database master on instance .\$SQLINSTANCE$ as user sa
       
      Comment: MessageBox: debug, oldsqlproductcode: $OLDSQLPRODUCTCODE$ $NEWLINE$oldsqldataroot: $OLDSQLDATAROOT$$NEWLINE$olddbinstanceregpath: 
$OLDDBINSTANCEREGPATH$$NEWLINE$newsqlproductcode: $NEWSQLPRODUCTCODE$$NEWLINE$newsqldataroot: $NEWSQLDATAROOT$$NEWLINE$newdbinstanceregpath: 
$NEWDBINSTANCEREGPATH$$NEWLINE$db2008target: $DB2008TARGET$$NEWLINE$source: $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.*$NEWLINE$$NEWLINE$
       
      else
      Comment: do nothing
    end
    Comment: ---------------------------------------------------------------------------------------------------
    else
     
    Comment: MessageBox: debug, oldsqlproductcode: $OLDSQLPRODCODE$$NEWLINE$oldsqldataroot: $OLDSQLDATAROOT$$NEWLINE$olddbinstanceregpath: 
$OLDDBINSTANCEREGPATH$$NEWLINE$newsqlproductcode: $NEWSQLPRODCODE$$NEWLINE$newsqldataroot: $NEWSQLDATAROOT$$NEWLINE$newdbinstanceregpath: 
$NEWDBINSTANCEREGPATH$$NEWLINE$db2008target: $DB2008TARGET$$NEWLINE$source: $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.*$NEWLINE$$NEWLINE$
     
    Comment: kein prodcode 
    Comment: use .bak file
    if Variable USE_ENUMERATED_INSTANCE not Equals TRUE
      Comment: => nicht custom oder install_new_isntance = true
      Include Script: setupsql2008
      Run Program sc config SQLBrowser start= auto (WAIT)
      Run Program sc start SQLBrowser (WAIT)
    end
    Set Variable NEWSQLPRODUCTCODE to 
    Set Variable NEWSQLDATAROOT to 
    Set Variable NEWSQLBACKUPPATH to 
    Set Variable NEWDBINSTANCEREGPATH to 
    Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL\$SQLINSTANCE$ into NEWDBINSTANCEREGPATH
    Set Variable NEWDBREGPATHFORBACKUPPATH to SOFTWARE\Microsoft\Microsoft SQL Server\$NEWDBINSTANCEREGPATH$\MSSQLServer
    Read Registry Key HKLM\$NEWDBREGPATHFORBACKUPPATH$\BackupDirectory into NEWSQLBACKUPPATH
    Read Registry Key HKLM\$NEWDBREGPATHFORPRODUCTCODE$\SQLDataRoot into NEWSQLDATAROOT
    Set Variable DB2008TARGET to $NEWSQLDATAROOT$
    Install Files C:\Users\Windows7Pro\Desktop\TRUNK\runimage\database\*.* to $TARGETDIR$\database, include subfolders
    Copy Local Files $TARGETDIR$\database\*.* to $NEWSQLBACKUPPATH$
    Microsoft SQL Server Script : Connect to database master on instance .\$SQLINSTANCE$ as user $SQLUSER$
    Microsoft SQL Server Script : Connect to database master on instance .\$SQLINSTANCE$ as user $SQLUSER$
     
    Comment: MessageBox: debug, oldsqlproductcode: $OLDSQLPRODCODE$$NEWLINE$oldsqldataroot: $OLDSQLDATAROOT$$NEWLINE$olddbinstanceregpath: 
$OLDDBINSTANCEREGPATH$$NEWLINE$newsqlproductcode: $NEWSQLPRODCODE$$NEWLINE$newsqldataroot: $NEWSQLDATAROOT$$NEWLINE$newdbinstanceregpath: 
$NEWDBINSTANCEREGPATH$$NEWLINE$db2008target: $DB2008TARGET$$NEWLINE$source: $OLDSQLDATAROOT$\DATA\$SQLDBNAME$*.*$NEWLINE$$NEWLINE$
     
  end
end
[DEFINE WEB MEDIA Client]
Get Component Client Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
  Comment: ---------------------------------------------------------------------------------------------------
  Comment: Find old versions
  if Variable PRODCODE not Equals 
    Install/Remove MSI Package $PRODCODE$[REMOVE=ALL]
  end
   
  Install Files C:\Users\Windows7Pro\Desktop\TRUNK\runimage\*.* to $TARGETDIR$, include subfolders
 
  Write Registry Key HKCU\Software\company\product\Settings\Serial, myserial
  Write Registry Key HKCU\Software\company\product\UpdateInfo\ReleaseDatum, 01.12.2012
  Write Registry Key HKCU\Software\company\product\UpdateInfo\UpdateHinweisDatum, 01.06.2013
end
[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
  Apply Advertised (get result into variable SUCCESS)
  else
  Apply Install (get result into variable SUCCESS)
  if Variable SUCCESS not Equals ERROR
    if Variable SUCCESS not Equals CANCEL
      Get Component Database Selection State into Variable SELECTED
    end
  end
end
[compiler end]
Set Variable PROGRESS to 100
<<Code Folding Region>>
<<Code Folding Region>>
 
[DEFINE REGION: Finish Setup]
Comment: End of Installation
Hide Dialog
Display Dialog: finish, wait for dialog to return (modal)
if Variable SILENT Equals FALSE
  if Variable REBOOTCOMPUTER Equals TRUE
    if Variable SUCCESS Equals REBOOT
      Reboot Computer
    end
  end
  if Variable RUNAPP Equals TRUE
    if Variable REMOVE Equals FALSE
      if Variable SUCCESS Equals COMPLETE
        Comment: TO-DO: Insert command that starts your application here
        Run Program $TARGETDIR$\HonorarKalkulation.exe 
      end
    end
  end
end
<<Code Folding Region>>
 

Last edited by anja_laenge on Mon Dec 10, 2012 3:22 am, edited 1 time in total.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: MSI TRansaction clarification

Post by FrancescoT »

Dear Anja,

could you please send your code or even better a small project that replicate your issue to: [email protected]?

Many thanks.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply