I want to install microsoft visual c++ 2008 redistributable package along with my msi installer. I decide to include it along with my installer as an application file and i wrote a golang code that triggers the silent installation of microsoft visual c++ 2008 redistributable package. The Service of my application starts only when microsoft visual c++ 2008 redistributable package is installed. I could see a uninstall option for my application in the Control panel but i couldnt see anything like that for the microsoft visual c++ 2008 redistributable package. And i am pretty sure that the package is not installed because my application never starts, when i trigger the silent.exe (as an administrator) alone which has the code to silently install the package it gets installed and my application works fine as well. The problem occurs when i try to pack everything in a single msi.
The WiX Source file i wrote to include the silent.exe and also other necessary files i need for my application.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
<?include "CommonVariable.wxi"?>
<Product Id="*" Language="1033" Manufacturer="Testing" Name="Testing_Name" Version="1.1.1">
<Package InstallerVersion="111" Compressed="yes" Description = "(x64 Edition) MSI Package" Comments="(x64 Edition) MSI Package" InstallPrivileges="elevated" Platform="x64"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="MYINSTALLLOCATION" Name="$(var.foldername)">
<!-- Component for list of files to add in Installation location -->
<Component Id="ApplicationFiles" Guid="{**********-*******-*******-********}">
<File Id="ApplicationFile" Source="silent.exe" Vital="no" DiskId="1" Hidden="yes"/>
<File Id="ApplicationFile1" Source="Windows2008R2.exe" Vital="no" DiskId="1" Hidden="yes"/>
<File Id="ApplicationFile1" Source="Myfiles" Vital="no" DiskId="1" />
<File Id="ApplicationFile1" Source="Myfiles" Vital="no" DiskId="1" />
</Component>
***other Actions for my Application***
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="MYINSTALLLOCATION">
<Component Id="CleanupMainApplicationFolder" Guid="{**********-*******-*******-********}" Win64="yes">
<util:RemoveFolderEx On="uninstall" Property="MYINSTALLLOCATION" />
</Component>
</DirectoryRef>
<Property Id="MYINSTALLLOCATION" Value="$(var.InstallationLocation)" >
</Property>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles"/>
</Feature>
<Binary Id="ExeId" SourceFile="silent.exe"/>
<CustomAction Id="SilentAction" BinaryKey="ExeId" ExeCommand="" Execute='deferred' Return ='asyncWait' Impersonate='no'/>
<InstallExecuteSequence>
<Custom Action='SilentAction' Before='InstallFinalize'/>
</InstallExecuteSequence>
</Product>
</Wix>
The Silent.exe is the golang code i wrote has many functions the part of the code i wrote to silently install the package is as below.
package main
import (
"fmt"
"os/exec"
)
func main() {
/*........................
...........................
..........................*/
/*The code above is for my Different purpose */
co := exec.Command("C:\\Windows2008R2.exe","/q","/c:\"msiexec","/i","Windows2008R2.msi","/qn","/l*v","C:\\Windows2008R2_x64.log\"")
if err := co.Run(); err != nil {
fmt.Println("Error: ", err)
}
}