0

I have the wix project installer. I want to use the update new version of my product. It works fine, but still shows me all dialogs and I need to enter params.(such as install path, user credential and other). How can I skip all dialogs and using all of these params from older (prev) installer version.

<Product Id="*" Name="$(var.ProductName) $(var.ProductVersion)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x64" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" />
<MediaTemplate EmbedCab="yes" />

<Feature Id="ProductFeature" Title="COMPANY.Product.Installers.Server" Level="1">
  <ComponentGroupRef Id="ProductComponents" />
  <ComponentGroupRef Id="ServerInstallerFiles" />
</Feature>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
<UIRef Id="WixUI_MinimalCustom"/>
<InstallExecuteSequence>
  <Custom Action="DoAfterInstallJobParams" Before="DoAfterInstallJob">Not Installed or REINSTALL</Custom>
  <Custom Action="DoAfterInstallJob" After="InstallFiles">Not Installed or REINSTALL</Custom>
  <Custom Action="DoBeforeUnstallJob" After="InstallInitialize">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFiles64Folder">
    <Directory Id="INSTALLFOLDER" Name="COMPANY" />
  </Directory>
</Directory>
</Fragment>

<Fragment>
<Property Id="DoBeforeUninstallJob" Value="[INSTALLFOLDER]" />
<Binary Id="CustomActionBinary" SourceFile="$(var.SolutionDir)Output\Installers\Actions\COMPANY.Product.Installers.Server.Actions.CA.dll" />
<CustomAction Id="DoAfterInstallJob" BinaryKey="CustomActionBinary" DllEntry="AfterInstall" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="DoAfterInstallJobParams" Property="DoAfterInstallJob" Value="HOSTING_URL=[HOSTING_URL];DB_CONNECTION=[DB_CONNECTION];INSTALLPATH=[INSTALLFOLDER];LOGIN=[LOGIN];PASSWORD=[PASSWORD]" />
<CustomAction Id="DoBeforeUnstallJob" BinaryKey="CustomActionBinary" DllEntry="BeforeUninstall" Execute="deferred" Return="check" Impersonate="no" />
</Fragment>

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <ComponentRef Id="cmpServerHost"/>
</ComponentGroup>
</Fragment>

<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
  <Directory Id="ServerHost" Name="ServerHost">
    <Component Win64="yes" Id="cmpServerHost" Guid="a4a81104-1e30-463d-87e1-e8a79b4c6829">
      <File Id="ServerLog4netConfig" Source="$(var.SolutionDir)..\Logging\log4net.config" />
      <RegistryValue Root="HKLM" Key="Software\[Manufacturer]\$(var.ProductName)" Type="string" Value="[INSTALLFOLDER]" KeyPath="yes" Name="COMPANYInstallPath"/>
      <File Id="AppVersion" Source="$(var.SolutionDir)Output\Installers\Actions\COMPANY.Product.Installers.Server.Actions.CA.dll" />
    </Component>
  </Directory>
</DirectoryRef>
</Fragment>
RomanReaL D
  • 101
  • 5

2 Answers2

0

Windows Installer does not persist properties. You have to do it yourself. Here is an example.

http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Thank you! I saw this expample, but besides I need to skip dialogs with enter data. Or its possible only in silence mode? – RomanReaL D Apr 05 '19 at 18:40
  • That's actually a different question. You would need to use the remembered property values to control which dialogs get displayed. Please remember to accept and upvote answers that are helpful. – Christopher Painter Apr 05 '19 at 19:11
  • And what about saving password param in registry . Its not safe – RomanReaL D Apr 05 '19 at 19:19
  • That's another question. – Christopher Painter Apr 05 '19 at 19:23
  • @RomanReaLD You would need to encrypt passwords. I would try to avoid passwords. Are they for service installations? – Stein Åsmul Apr 05 '19 at 22:23
  • Coincidentally I just did a project exactly like this last week for a client in Houston. I have other tricks that avoid saying the username / password in the first place. Service accounts change, passwords change... it's sometimes best to allow the installer to initially configure it but not manage it. – Christopher Painter Apr 06 '19 at 04:04
  • @SteinÅsmul yes, I need to encrypt password for win service – RomanReaL D Apr 07 '19 at 11:05
  • Could you run the service with a built-in, password-less account such as ``LocalService``, ``LocalSystem`` or ``NetworkService``? Or by means of the newer concept of ``managed service accounts`` / ``group managed service accounts`` / ``virtual accounts``? [See this answer](https://stackoverflow.com/a/50375540/129130) and [this one](https://stackoverflow.com/a/50778838/129130). Nothing to encrypt in this case? – Stein Åsmul Apr 07 '19 at 12:09
  • *"A service account is a user account that is created explicitly to provide a security context for services running on Windows Server operating systems...A managed service account is designed to isolate domain accounts in crucial applications, such as Internet Information Services (IIS), and eliminate the need for an administrator to manually administer the service principal name (SPN) and credentials for the accounts."* [Service Accounts](https://learn.microsoft.com/en-us/windows/security/identity-protection/access-control/service-accounts). – Stein Åsmul Apr 07 '19 at 12:10
0

Remember Properties: Persisting properties allows you to read back the settings from the first version.

Dialog Control & Order: In order to skip dialogs you need to detect whether a major upgrade is taking place, if you use major upgrades (which you do based on that source file), and then control the dialog flow accordingly using conditioning and property values. This requires quite a bit of work and testing. I would avoid it if you can.

Easy Mode: Just disabling (write protect) or hiding the dialogs fields that contain settings written in the first setup might be preferable (rather than changing the dialog sequence). You can use conditions and conditioning for both purposes.


Maintenance GUI: For minor upgrades, repair and uninstall the dialog set will be different from the original installation. You will get a "maintenance dialog set" presented rather than the "installation dialog set".

Major Upgrade: A pecularity occurs when you install upgrades via Windows Installer's major upgrade mechanism. Because of how this works technically you get the installation dialog set for the new version as well. This is because it is technically a fresh install of that new product code. The fact that the older version gets uninstalled as part of the process is besides the point. You are not installing a new minor version, you are uninstalling and reinstalling effectively.

WIX_UPGRADE_DETECTED: There is a property that is set in a standard WiX package. It is WIX_UPGRADE_DETECTED. It can be used to detect when a major upgrade is taking place and hence used in conditions to adjust the dialog order of a major upgrade installation. Here are more details on this property, along with description of UPGRADINGPRODUCTCODE - which is another property that is set in the setup being uninstalled (not in the new one being installed).

Ran out of time. Persisting this, will update later.


Some Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164