wix,windows-installer,conditional,condition,custom-action , Wix: Run custom action based on condition


Wix: Run custom action based on condition

Question:

Tag: wix,windows-installer,conditional,condition,custom-action

I'm trying to run a custom action (delete a certain file) based on the windows version. I know how to check for the windows version:

<Condition Message="Windows version xxx required...">
    <![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition>

However, I do not want to display a message, but delete a file. I can't find an example on how to use such a condition to run oder not to run a custom action!

Does someone have an answer?

Greets


Answer:

You need to specify the condition inside the Custom element which runs your custom action. (This allows you to run the custom action multiple times in different locations in your sequence and with different conditions each time if desired).

Example:

<InstallExecuteSequence>
  <Custom Action="CreateRegistryEntries" After="CostInitialize">
    NOT Installed AND NOT PATCH
  </Custom>
</InstallExecuteSequence>

Related:


Upgrading MSI throwing 'method not found' error


c#,visual-studio-2013,windows-installer
I have a project with two class libraries. I used 'Setup and deployment tool' to make MSI files. Initially, I have build v 1.0.0 and installed in a machine. After that, I have made few changes in my libraries and made a build v 1.0.1. When I tried to install...

command line Start.Info.Argument error


c#,command-line,wix,heat
I would like run this command with C# : "%WIX%/bin/heat.exe" dir "C:\Documents and Settings\APP" -gg -sfrag -cg Appli -out wixappli.wxs I have this code (Program.cs) : System.Diagnostics.Process process1 = new System.Diagnostics.Process(); process1.StartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe"); process1.StartInfo.Arguments = String.Format("/k \"%WIX%/bin/heat.exe\" dir \"{0}\" -gg -sfrag -cg Appli -out wixappli.wxs ", @"C:\Documents and...

Change Wix Product version number using NANT XmlPoke


build,wix,nant,wix3.9
I ran into this issue recently - when I try to replace the Wix Product version number using NANT XMLPOKE task, it returns the following error message "No matching nodes found". <xmlpoke file="..\Setup\abc.wxs" xpath="//Wix/Product[@Version]" value="${version.label}" > Initially I thought that this was an issue with XPATH statement that I wrote....

How to define WIX agent requirment in TeamCity?


msbuild,wix,teamcity
I have add a WIX installer project to solution in Visual Studio 2013. The project is built with every commit on TeamCity. There are several build agents connected to TeamCity cloud, but only some have WIX installed. Usually I would add the build agent requirement, so only the computer with...

WiX error build target


msbuild,wix,installer
I'm trying to create my MSI setup with WiX and MSBuild command which deploy my img.png into a repertory and i have this error : "MSB4019: project imported "C:\Program Files\MSBuild\Microsoft\WiX\v[[Version.M ajor]].x\Wix.targets" was not found. " Make sure that path of declaration are correct In this line : <Import Project="$(WixTargetPath)" />...

Want to create mysql user in installation with full Privileges In NSIS


mysql,windows,windows-installer,nsis
I am using following code but did not succeed, please help !define deflogin root !define defpassword mysqlpassword !define HOSTPORT "%" ExecWait '$folder\bin\mysql --user=${deflogin} --password=${defpassword} --execute="grant all privileges on *.* to $\'${login}$\' @ $\'${HOSTPORT}$\' identified by $\'${password}$\'"' ${login} & ${password} taken by a custom .ini configuration by following process Function .onInit...

Cant find File System, Registry icon in WIX setup project in Visual Studio


visual-studio-2012,wix
I installed WIX in my machine. I followed the video of https://www.youtube.com/watch?v=CoFPyIbcqN8enter link description here I can not find any way to add File Systems, no icon for it, no context menu entry on project. I am using Visual Studio 2012....

WiX - not executing custom action during update


wix,windows-installer,installer,custom-action
I have two custom actions (immediate and deferrend). I would like to skipping actions during upgrade. I tried: <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)" UpgradeCode="{GUID}"> <MajorUpgrade DowngradeErrorMessage="Newer version is already installed." /> <Custom Action='CAa' After='InstallInitialize'>NOT Installed AND NOT PATCH</Custom> and: <Custom Action='CAa' After='InstallInitialize'>NOT Installed AND NOT...

Deploy Any CPU build with WiX to x86 using MSBuild


visual-studio-2013,tfs,msbuild,wix
I have a set of solutions that build a complete .NET Any CPU application. I have a WiX project that will deploy that application as x86 and I can run this all manually in Visual Studio 2013 without any issues. Now I'm trying to get this to work in MSBuild...

How to change text style of the Title & Description text controls of a WiX dialog?


wix
Where can I find information of the Style values for a text control of a WiX dialog? For example, the default text style used for the WiX dialog Title control is {\WixUI_Font_Title} & I would want to use the same style but to change the color to White. For the...

How do I install the Wix extension on after a Visual Studio 2013 Update?


visual-studio-2013,wix
I have installed Wix 3.9 on VS 2012. Recently, I just got VS 2013 and I am not sure how to install just the extension on there? How do I do without uninstalling wix 3.9 and reinstalling it back again?...

WiX: VS2013 How to change output directory


visual-studio-2013,wix,windows-installer
I have a WiX project in VS2013. The output directory in wixproj is: bin\$(Platform)\$(Configuration)\ by fact it is \bin\x64\Release\en-us How and where I can change the real output to \bin\x64\Release\ ?...

executing an vb script from another project bud in the same solution in C#


c#,vb.net,wix
i am trying to call a VB script that i made that in the same solution bud in another project, it is a C# project with windows forms and WIX. i am building an .MSI installer and when i arrive at a certain form i want it to execute a...

How to change $(var.Platform) from x86 to Win32 in Wix


c++,wix,platform
I have a Visual C++ 2013 solution including many C++ projects and a WIX installer project. On x64 platform, everything is okay. But On x86 platform, $(OutDirectory)$(Platform)$(Configuration) of C++ projects is ...Win32..., but $(OutDirectory)$(Platform)$(Configuration) of WIX is ...x86... What can I do?

Error allocating file install folder in WIX 3.9


directory,wix,windows-installer
I am setting up the installation locations for my installer. However, it throws an error when I try to set the locations. Source code: <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" Name="Wix_setup" Language="1033" Version="1.0.0.0" Manufacturer="Frank Jansen" UpgradeCode="37a42e55-dea8-47da-8f4f-fb065dd38a9e"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of...

Wix Toolset install C++ 2010 Redistributable


wix,visual-c++-2010,wix3.8,wix3.9
I can integrate together on installation package Wix Toolset the installer Microsoft Visual C ++ 2010 redistributable? I tried this with a custom action, but it does not install if another installation is in progress. Someone would have any suggestions of how to do? Also another question. I can call...

Should a WiX web installer and stand-alone installer both show up in Add/Remove programs?


wix,wix3.9
We have two WiX installers that use our own BA. One installer gets all the packages from the web, while the other gets all the packages from the exe. We call them "Web" and "Full" installers. We have a case where a user might install one package from the web...

How to change Install button display text conditionally


wix,windows-installer,wix3.8
Is it possible to change the "Install" button display text based on some condition i.e if fresh install then "Install" if upgrade then "Update"? Basically, on major upgrade i am skipping some of my custom dialogs (which are shown on fresh installation) so on InstallReady dialog i want to show...

Issue faced during uninstall MSI using its Product Code in c#(DTF)


c#,windows-installer,dtf,wix3.9
I am creating a CustomBA which will replace the existing install shield Bootstrapper( I don't really know what it's called). We are installing the same number of MSI as the install shield use to do, so no problem in that. All the MSI entries in the ARP are removed, as...

Service dependencies are causing my wix msi to force a reboot on uninstall


wix,windows-installer
I have spent the past 3 days running in-place while tracking down the cause of forced reboots on my system, but have finally narrowed it down to a very specific cause. I have a service suite that I am working on in Wix. There are 10 msi's that are all...

How to uninstall a program using C#? [duplicate]


c#,visual-studio,visual-studio-2012,command-line,windows-installer
This question already has an answer here: How to uninstall MSI using its Product Code in c# 4 answers I'm trying to uninstall a program using C# via Visual Studio and possibly CMD. I made several attempts but could not getting anything to go. Attempt #1: RegistryKey localMachine =...

WiX - upgrade services


wix,installer
I Installed my application in 1.0.0.0 version. Services have been installed on the user account (with username / password). How to make an update, so the user does not have to specify login and password again? <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />   <Component Id="MyService" Guid="MyGUID"...

WIndows Installer Putting shortcuts into a custom folder with a property


windows-installer,installshield
I am building an installer with InstallShield. It is a basic MSI project (I'd rather not have any dependencies on InstallShield that might make it more difficult to move to WiX in the future). I am attempting to put some shortcuts into a custom folder that I'd like to locate...

WiX: Install component based on ComboBox selection


combobox,wix,condition
I'm trying to create an installer which installs some components based on the selection of a Combobox but it seems like the condition isn't working. I declared the Combobox as the following: ... <UI> <ComboBox Property="Option"> <ListItem Text="Red" Value="red" /> <ListItem Text="Blue" Value="blue" /> <ListItem Text="Green" Value="green" /> </ComboBox> ......

Trigger uninstall and Repair of previously installed product


wix,windows-installer,wix3.8
i am new to Wix toolsets. i have successfully made my first installer in Wix but now i am confused about my software updates which usually are minor. in my installer i want to check if user have any older version installed then i want to show him three options...

Creating a silent installer for a MSI


wix,nsis,msiexec,silent-installer
What is the best way to make a silent installer (or unattended) for a program that was already created and has a msi installer? At work I'm told to create an installer that is automated and does all the interaction with the user automatically so that the user essentially just...

Create a new user with an underscore in the name


xml,wix,windows-installer
I am trying to create a user in WiX, using the following XML: <Component Id="cmp_MyNewFolder" Guid="*"> <util:User Id="MyNewUser" CreateUser="yes" Name="DUMMY&#95;USER" Domain="[ComputerName]" Password="" PasswordNeverExpires="yes" RemoveOnUninstall="yes" UpdateIfExists="yes" /> <CreateFolder> <util:PermissionEx GenericAll="yes" User="DUMMY&#95;USER"/> </CreateFolder> </Component> I've removed the GUID and password for this post, so the issue isn't with those. The problem is...

ExePackage does not run elevated although PerMaschine is set to “yes”


wix,bootstrapper,elevated-privileges
In my WIX-Bundle, i have an ExePackage like the following: It executes a ConsoleApplication which tries to open an write to a HKLM-Registry entry which fails when triggered out of the bundle. In cmd, everything works fine when executed as admin: <ExePackage Id="SqlServerAuthConfig" DisplayName="Configuration of SQL-Server Auth-Mode" Compressed="yes" PerMachine="yes" Vital="yes"...

Running msi causes “module failed to register” in 32bit win7,but works in 64bit win7


c++,windows,dll,windows-installer
I'm trying to deploy my project and create an installer. I've created a msi file in vs2005. When running the .msi setup wizard, i'm getting the error: "Module abc failed to register. HRESULT -2147010895. Contact your support personnel." The module that failed to register is a C++ com dll.But in...

WIX XMLConfig Different Root Element Names


wix
I'm running into an odd issue with a "config" msi I'm writing in WIX that uses XMLConfig to check for, delete and then create the new values in a single xml file. Since I Discovered WIX I've been packaging a lot of our manual configuration processes so this is my...

WIX-Installer ServiceControl “sufficient privileges” error


c#,windows-services,wix,installer,visual-studio-2015
Visual Studio 2015 RC Wix v3.10.0.1726 I am creating a installer for a windows services. I've tested the service with InstallUtil and it runs fine. Unfortunately I'm having a bit of troubles with wix, here is the exact error - "Service 'Service Name' failed to start. Verify that you have...

Single Package Authoring


wix,windows-installer
I am trying to create Single Package Authoring installation using following tutorial - http://www.egoroff.spb.ru/blog/62003.html Main wix file is following: <?xml version='1.0' encoding='windows-1252'?> <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> <Product Name='Foobar 1.0' Id='GUID' UpgradeCode='GUID' Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'> <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer" Comments='Foobar is a registered trademark of Acme Ltd.'...

Namespace prefix 'bal' is not defined


wix
I've got this error. Since I put below code in the Bundle.wxs. <BootstrapperApplicationRef Id="WixExtendedBootstrapperApplication.Hyperlink2License"> <bal:WixExtendedBootstrapperApplication ThemeFile="Resources\COTheme.xml" LicenseUrl="http://xxxxxx /> </BootstrapperApplicationRef> Could please anyone help me?...

How to add assemblies to WiX toolset setup, which comes from a nuget package?


c#,.net,wix
I use the Votive-project type to create a setup with the WiX toolset. I know, that I can add an assembly like this to the setup: <File Id="FILE_myproject.dll" Source="$(var.myproject.TargetPath)" KeyPath="yes" /> What I don't know is, how can I add referenced assemblies to the setup, which comes in a nuget...

How can a single installer 'Setup.exe' be used to install multiple instances of same application


windows-installer,installer,installshield,multiple-instances
I have created a installer of type InstallScript MSI installer using InstallShield 2008 and it is working. Now I want to install multiple instances of same product on same machine using same installer. I want to show them as a separate application in Add/Remove programs and also a separate directory...

Is Component/@Guid attribute is a MUST in case of producing MergeModule


wix
In my .wxs file for components, there are only components with single file, and this is the case for generatable GUIDs. But it seems to me that for .msm (merge module), component's GUID should be explicitly specified. Or I'm free to use Guid="*" and that would be OK? I tried...

How to launch executable after installation (exe is delivered by .msm)


wix,custom-action
I did everything as explained in tutorial, but my executable wasn't launched after product installation completed. There is a nuance that my executable is delivered with .msm module, so in .wxs file for .msi I do the following to launch application: <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product> <!-- I omit here features and...

Retrieve x64 Program Files path from 32-bit process


c#,wix,64bit
First some background. I have created a WPF bootstrapper application for my WiX installer where I need to retrieve and display the default install location. Unless I am doing something wrong it appears the executable created by WiX is always 32-bit even if my Visual Studio configuration is set to...

install msi with a product code through msiexec


installation,windows-installer,installer,msiexec
I am a new to msi installations through command prompt.Can anyone show me how to install an application with product code through msiexec. Currently I am using the command : msiexec /i "D:\msiexec\Calculator\CalculatorInstaller\CalculatorInstaller\Express\DVD-5\DiskImages\DISK1\CalculatorInstaller.msi" ProductCode="42F48712-5C2E-41D1-83CC-2D28C91C889A" but though it's getting installed, I am not able to verify that at HKEY_LOCAL_MACHINE>Software>Microsoft>Wow6432nodeMicrosoft>windows>Uninstall . Please...

How to understand which MSI file start


windows,windows-installer
I have W8.1 and i need know which MSI file start when OS opening because installation is corrupted and all time i need press cancel. I want delete it to stop starting with Explorer.exe I already tried to deactivate all process in tab process of Task Manager but don't work....

WiX – copy arbitrary files


c#,wix
The folder where my setup.exe is located contains a subfolder CALhaving files named something like xyz1234.cal – their names vary from customer to customer. These files have to be copied into a folder CAL in the target directory. So I created a CustomAction and a C# dll which uses the...

SHFileOperation cannot remove folder


c++,wix
I am writing a C++ Custom action for WiX that will be called during installation to remove any leftovers installed by the installer. Consider the following code: UINT __stdcall DeleteResidue(MSIHANDLE hInstall) { HRESULT hr = S_OK; UINT er = ERROR_SUCCESS; LPWSTR lpFolderPath = NULL; std::wstring temp; SHFILEOPSTRUCT shFile; hr =...