MSI installation sequence - running database scripts before starting services

People,

we encounter some sequence problems with our MSI installation. As part of our application, we install a bunch of services and allow the user to choose whether to start them immediately or later.

When they start right away, they seem to start too early in the installation sequence - before our database manager can update the database.

Currently, our custom action for starting the database updater is as follows: it starts after "InstallFinalize" - very late.

   <InstallExecuteSequence>
      <RemoveExistingProducts After='InstallInitialize' />
      <Custom Action='RunDbUpdateManagerAction' After='InstallFinalize'>
           DbUpdateManager=3</Custom>
   </InstallExecuteSequence>

What would be a more suitable step to start after or earlier to make sure that the database scripts are executed before any of the installed services are launched? Is there a way to "BeforeServiceStart"?

EDIT:

Just defining the "Before =" StartServices "attribute in the tag didn't solve my problem.

I suppose the problem is this: the user action has an “inner text” which is a condition, and that condition is: & DbUpdateManager = 3. From what I can deduce from trial and error, this probably means that the DbUpdateManager function should be published.

: "PublishFeature" , "InstallFinalize", InstallServices/StartServices. , "Before = StartServices", " DbUpdateManager " , DbUpdateManager : - (

- DbUpdateManager , - , , .....

? " ​​ DbUpdateManager", "InstallFiles"?

+3
2

BeforeServiceStart, Before='StartServices'.

+1

, , marc_s question. , , , , :

...
<InstallExecuteSequence>
  <Custom Action="CopyConfigs" 
          After="InstallFiles"><![CDATA[&ProductFeature = 3]]></Custom>
</InstallExecuteSequence>
<CustomAction Id="CopyConfigs"
              FileKey="copySamples"
              ExeCommand=""
              Execute="deferred"
              Impersonate="no"/>

<Directory Id="TARGETDIR" Name="SourceDir">
...
  <Directory Id="Config" Name="Config">
    <Component Id="ShippedConfigs" Guid="{8E6344C8-2B3F-4654-8B42-C09E76200052}">
      <File Id="copySamples"
            Source="$(var.ProjectDir)config\Copy.Configs.Sample.cmd"
            KeyPath="no"
            DiskId="1" />
    </Component>
  </Directory>
</Directory>

<Feature Id="ProductFeature" Title="MyService" Level="1">
  <ComponentRef Id="ShippedConfigs" />
  ...
</Feature>
+1

Source: https://habr.com/ru/post/1705367/


All Articles