Installing .NET Framework from Wix - windows

I'm using WiX toolset v3.7 and Visual Studio 2013 to create an installer package for an Excel plugin.
The plugin depends on .NET Framework 4.5 and I'd like the installer to automatically detect whether the required framework exists on the target machine and if not, install it.
Googling got me to this page: http://wix.sourceforge.net/manual-wix3/install_dotnet.htm, but the link to instructions on how to create a Bundle is broken on that page.
I've tried adding the element to my root element but end up with errors. I've also tried a few examples I've found on the web but none of them seem to work properly with the default WiX manifest that was generated for me during project creation in VS2013.
What do I need to add to my manifest to enable automatic installation of .NET Framework 4.5?
I'd greatly appreciate any help here! My manifest is shown below:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Awesome Excel Add-in 1.0" Language="1033" Version="1.0" Manufacturer="Farhan Ahmed" UpgradeCode="7ffd5a6d-d38e-4d6b-b554-098d95791222">
<Package Description="Awesome Excel Add-in Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="AwesomeExcelSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<CustomAction Id='LaunchInstallerFile' FileKey='fAddinInstaller' ExeCommand='/I /64' Return='asyncWait' />
<CustomAction Id='LaunchRemoverFile' FileKey='fAddinInstaller' ExeCommand='/U' Return='check' />
<InstallExecuteSequence>
<Custom Action='LaunchInstallerFile' After='InstallFinalize'>NOT Installed</Custom>
<Custom Action='LaunchRemoverFile' Before='RemoveFiles'>Installed AND NOT REINSTALL</Custom>
</InstallExecuteSequence>
<UI>
<UIRef Id="WixUI_Minimal" />
</UI>
<Icon Id="icon.ico" SourceFile="$(var.AwesomeExcelAddin.TargetDir)\Awesome.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="INSTALLPARENT" Name="Awesome" >
<Directory Id="INSTALLFOLDER" Name="Excel Add-in 1.0" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent" Guid="DDD3F332-0DF1-47F0-B8D0-5E1E09BF69BE">
<File Id="f32bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked32.xll" />
<File Id="f64bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked64.xll" />
<File Id="fAddinDll" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeExcelAddin.dll" />
<File Id="fAddinInstaller" Source="$(var.AwesomeExcelAddinInstaller.TargetDir)\AwesomeExcelAddinInstaller.exe" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

Thanks to the comment by Netfangled, I was able to move forward.
Like he (she?) mentioned, the trick was to create another project for the Bootstrapper and then reference the .NET Fx and the MSI in that manifest.
Although I did run into a "environment variable not defined" issue, I was able to work around the problem by specifying a source file using the Solution directory as the base.
Here's the new manifest:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Awesome Excel Plugin Setup" Version="1.0.0.0" Manufacturer="Awesome Software" UpgradeCode="1f605e3b-2954-403c-b9cb-ca1f0e8bf65b">
<WixVariable Id="WixStdbaLogo" Value="Logo.png" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<WixVariable Id="WixStdbaLicenseRtf" Value="License.rtf" />
<Chain>
<PackageGroupRef Id="NetFx45Redist"/>
<MsiPackage Id="AwesomeExcelSetupMSI"
SourceFile="$(var.SolutionDir)\AwesomeExcelSetup\bin\release\AwesomeExcelSetup.msi"
Vital="yes"
Compressed="yes"/>
</Chain>
</Bundle>
</Wix>

Related

What is the proper way to add multiple class library projects in wix installer

I am trying to create a wix installer for window service. My service consists four class library projects. My questions is how can i add multiple class library projects in wix installer. I followed this link https://github.com/Robs79/How-to-create-a-Windows-Service-MSI-Installer-Using-WiX/blob/master/WindowsService.Installer/Product.wxs its not shows how to add multiple class library projects. Please some one help me out how can do this. or provide some reference link where i can refer.
Thanks in Advance
Product.wxs:
<?define Manufacturer = "IRIZ ID TECH" ?>
<?define VersionNumber = "1.0.0.0" ?>
<?define UpgradeCode = "{FF9D7B21-A4FE-4DEB-A2FE-E77228F95831}" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
UpgradeCode="$(var.UpgradeCode)"
Version="$(var.VersionNumber)"
Language="1033"
Name="$(var.Name)"
Manufacturer="$(var.Manufacturer)">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="ESS_VillageMateIntegrtion" EmbedCab="yes"></Media>
<!-- Allow upgrades and prevent downgrades -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="WindowsService.Installer" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="$(var.Name)" />
</Directory>
</Directory>
</Directory>
</Fragment>
<!-- Add files to your installer package -->
<Fragment>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="$(var.ESS_VillageMateIntegrtion.TargetFileName)" Guid="{F03996CC-3A49-47A7-91F1-27DBF563AE83}">
<File Id="$(var.ESS_VillageMateIntegrtion.TargetFileName)" Source="$(var.ESS_VillageMateIntegrtion.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetFileName)" Guid="{CC064C9B-298A-4D6D-AF64-40DA3657AAAB}">
<File Id="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetFileName)" Source="$(var.ESS_VillageMateIntegrtionServiceConfig.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateService.TargetFileName)" Guid="{CB37D43D-BB08-4DF2-A7B0-87A819A66CED}">
<File Id="$(var.ESS_VillageMateService.TargetFileName)" Source="$(var.ESS_VillageMateService.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="$(var.ESS_VillageMateIntegrationTray.TargetFileName)" Guid="{71FD65C9-A657-4093-8D5A-28743972E536}">
<File Id="$(var.ESS_VillageMateIntegrationTray.TargetFileName)" Source="$(var.ESS_VillageMateIntegrationTray.TargetPath)" KeyPath="yes" />
</Component>
<Component Id="Components">
<!-- Remove the log file on uninstall -->
<RemoveFile Id="log" Name="*.txt" On="both" />
<!-- Tell WiX to install the Service -->
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="ESS_VillageMateIntegrtion"
DisplayName="ESS_VillageMateIntegrtion Service"
Description="Write Data one DB to another DB"
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<!-- Tell WiX to start the Service -->
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="ESS_VillageMateIntegrtion"
Wait="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>

Unresolved reference to symbol 'WixComponentGroup:MyWebWebComponents' in section

I was following the below code which is product.wxs files.But I am facing an error as below:
Error 5 Unresolved reference to symbol 'WixComponentGroup:MyWebWebComponents' in section 'Product:{}'
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Product Id="702881b5-9a64-4ab8-ab47-f3babcd950a2"
Name="WixApplication" Language="1033"
Version="1.0.0.0"
Manufacturer="HexWireless"
UpgradeCode="42b7872b-78c8-4a0b-abcd-28a30c9804ab">
<Package InstallerVersion="200" Compressed="yes" Platform="x64" InstallScope="perMachine"/>
<!--<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />-->
<!--Find the Path to the sqlcmd.exe by performing a registry search. This is hardcoded for SQL 2012.
Change 110 to 100 for 2008. Might need to change the script too.-->
<Property Id="SQLBINDIR">
<RegistrySearch Id="SqlBinDir"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\110\Tools\ClientSetup"
Name="Path"
Type="raw"
Win64="yes"/>
</Property>
<Condition Message="Microsoft SQL Server 2012 needs to be installed before this installer can run">
<![CDATA[SQLBINDIR]]>
</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="Database">
<Component Id="Database" Guid="a8dc2Fcd-087d-e393-b059-c67877e51b8a">
<File Id="DatabaseScript" Source="SQLScripts\HexWireless.sql"/>
<RemoveFile Id ="RemoveInstall.log" Name="Install.log" On="uninstall" />
</Component>
</Directory>
<Directory Id="INSTALLDIR" Name="PFiles">
<Directory Id="WixService" Name="Service">
<Component Id="WixWindowsServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="WixService.exe" Name="WixService.exe" Source="$(var.WixService.TargetDir)\WixService.exe"/>
<ServiceInstall Id="InstallWixService" DisplayName="WixService" Name="WixService.exe" Description="WixService" Account="NT Authority\Network Service" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlWixService" Name="WixService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</Directory>
</Directory>
<Directory Id="INSTALLFOLDER" Name="Publish">
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WebApplication" Level="1">
<Feature Id="Database" Title="Database" Description="DatabaseScript" Level="1" Display="expand"
AllowAdvertise="no" ConfigurableDirectory="INSTALLLOCATION" Absent="allow">
<Feature Id="WixWindowsServiceComponent" Title="Service" Description="WixService" Level="1" Display="expand"
AllowAdvertise="no" ConfigurableDirectory="INSTALLDIR" Absent="allow">
<ComponentGroupRef Id="WixWebsiteIssConfiguration" />
<ComponentRef Id="Database"/>
<ComponentRef Id="WixWindowsServiceComponent"/>
<ComponentGroupRef Id="MyWebWebComponents"/>
</Feature>
</Feature>
</Feature>
<Property Id="INSTALLDIR" Value="D:" />
<Media Id="1" Cabinet="WixWindowsServiceComponent.cab" EmbedCab="yes" />
<InstallExecuteSequence>
<!--If the database feature is selected these actions will run to install the DB-->
<Custom Action="Database.cmd" After="InstallFiles" >
<![CDATA[NOT Installed]]>
</Custom>
<!--Ensure this runs after the custom action to set up the properties for its cmd line-->
<Custom Action="Database" After="Database.cmd">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
<UI>
<UIRef Id="GUI"/>
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
<!--This is the sequence script. Best way to understand this is by running sqlcmd -?
Use "property" Custom action to get variable substitution working-->
<CustomAction Id="Database.cmd" Property="Database"
Value=""[SQLBINDIR]sqlcmd.exe" -E -S "[SQLSERVER]" -i "[#DatabaseScript]" -o "[INSTALLLOCATION]HexWireless.log""/>
<!-- Note that the cmd line and args will come from a property with the same name as the custom action, this has been set by the custom action above -->
<CustomAction Id="Database" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="check" Execute="deferred" Impersonate="yes" />
</Product>
</Wix>
Thanks In Advance.
I am not sure if your issue is sorted or not, I just faced the same issue even though i have created a few of these msi files with Wix.
In my case, it wasn't finding the "HeatedComponents" that I am generating automatically within the project. I had to load this file into the project, (these files or folders may be inside your project folder but in most cases VS does not load them automatically).
You have to Right Click on the project -> Add -> Existing Item; and select the file/item that is required.

Migrate Wix Project to version 4.0

I recently ugraded Wix to Version 4.0.
After updating the namespaces Visual Studio (2015) won't recognize these new ones.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Product Id="*" Name="_any_name" Language="1033" Version="1.0.0.0" Manufacturer="Anyone" UpgradeCode="8c568038-54cf-43ff-aa2c-581f4dd0aea0" Codepage="1252">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="_any_title" Level="1">
<ComponentGroupRef Id="group_ProductComponents" />
</Feature>
<Property Id="pro_SetupExe" Value="INSTALLFOLDER" />
<CustomAction Id="ca_LaunchSetupExe" Property="pro_SetupExe" ExeCommand="/FORCE_HIDE_FIRST_RUN /UNATTENDED_INSTALL /AUTOACCEPT_ALL /FORCE_CLOSE_WHEN_DONE /ON_REBOOT_MESSAGE:”NO”" Execute="commit" />
<CustomAction Id="ca_SetSetupPath" Property="pro_SetupExe" Value="[INSTALLFOLDER]x64ATIDriver\setup.exe" />
<InstallExecuteSequence>
<Custom Action="ca_SetSetupPath" Before="ca_LaunchSetupExe" />
<Custom Action="ca_LaunchSetupExe" Before="InstallFinalize" />
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="TempFolder">
<Directory Id="INSTALLFOLDER" />
</Directory>
</Directory>
</Fragment>
</Wix>
The Wix element has an incorrect namespace of 'http://wixtoolset.org/schemas/v4/wxs'. Please make the Wix element look like the following: Wix xmlns = "http://schemas.microsoft.com/wix/2006/wi"
I founde these: Migrate Wix Project to v4.0 instructions
But I don't get what this means:
Fix: Explicitly set absent Id attributes on File element to the Name attribute or filename from the Source attribute.
So currently I just have the kind of "crashed" project and can't build.
I'd really appreciate some help.
regards Muffex
The namespace error makes it sound like the project is still being built by WiX v3. Also, that migrate to v4 page that you found is for the WixCop tool which automates everything you found there. It's in the bin directory of the WiX installation directory.

How to create a setup project using WiX to install two Visual Studio extensions

I need to create a setup project using WiX to deploy two Visual Studio Extensions(vsix). I create a project follow the steps that you can see in this blog: Creating WiX setup for VSIX. I can compile the project and generate the .msi file, but when I am going to install the extensions, it gave me a runtime error, the error code is 2343.
The XML of the WiX project is this:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:VSExtension="http://schemas.microsoft.com/wix/VSExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="{77F7DB1E-6E8A-44DB-88FE-9E496B140A2C}" Name="Bpmn Studio" Language="1033" Version="1.0.0.0" Manufacturer="Cadic" UpgradeCode="8c57d4aa-2b56-4561-94dd-cf02b34a4747">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" VolumeLabel="Bpmn Studio"/>
<PropertyRef Id="VS2013DEVENV"/>
<Condition Message="Visual Studio 2013 needs to be intalled for this installation to continue.">
<![CDATA[Installed OR VS2013DEVENV]]>
</Condition>
<!--Directory structure-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<UIRef Id="WixUI_InstallDir" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Casasoft" >
</Directory>
</Directory>
</Directory>
<Property Id="VSINSTALLDIR">
<RegistrySearch Id="VSInstallRegistry" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\12.0" Name="InstallDir" Type="directory" />
</Property>
<CustomAction Id="SetVSIXInstaller" Return="check" Execute="immediate" Property="VSIXInstaller" Value="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VSIXInstaller.exe" />
<CustomAction Id="DeployVSIX" Property="VSIXInstaller" Execute="deferred" Impersonate="no" ExeCommand="/quiet" Return="asyncWait"/>
<InstallExecuteSequence>
<Custom Action="DeployVSIX" After="MsiPublishAssemblies" />
</InstallExecuteSequence>
<Feature Id="BpmnStudio" Title="Bpmn Studio" Level="1">
<ComponentRef Id="BpmnStudioExtensionVSPackage" />
</Feature>
<Feature Id="ProjectTypeFeature" Title="Bpmn Studio Project Type" Level="1">
<ComponentRef Id="VSProjectTypePackage" />
</Feature>
</Product>
<Fragment>
<ComponentGroup Id="VSProjectTypeProductComponents" Directory="INSTALLFOLDER">
<Component Id="VSProjectTypePackage" Guid="BD8BA9C9-3728-4847-8428-EBECE32F79DA">
<VSExtension:VsixPackage File="VsBpmnStudioProjectTypeInstaller" PackageId="86e54529-745f-4b71-85f2-d2eb602bb777" Target="professional" TargetVersion="12.0" Vital="yes" Permanent="yes" />
<File Id="VsBpmnStudioProjectTypeInstaller" Name="BpmnStudioProject.vsix" Source="D:\Work\DSL\2013\Bpmn Studio\Common\Setup\BpmnStudioProject\bin\Debug\BpmnStudioProject.vsix" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="BpmnStudioExtension" Directory="INSTALLFOLDER">
<Component Id="BpmnStudioExtensionVSPackage" Guid="BD8BA9C9-3728-4847-8429-EBECE32F79DA">
<VSExtension:VsixPackage File="VsPackageInstaller" PackageId="86e54529-745f-4b71-85f2-d2eb602bb767" Target="professional" TargetVersion="12.0" Vital="yes" Permanent="yes" />
<File Id="VsPackageInstaller" Name="CasaSoft.BpmnStudio.DslPackage.vsix" Source="D:\Work\DSL\2013\Bpmn Studio\DslPackage\bin\Debug\CasaSoft.BpmnStudio.DslPackage.vsix" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Hi Jason: I found the empty path,Is when I set the path where I want to install the extensions in the UI Interface. The Value INSTALLALLOCATION doesn't exist. I change this value for INSTALLFOLDER and now works as I want

WIX installer how do remove install

I created a basic installer.
It takes a file from c:\temp.log and copy it to a directory that is being read from registry.
Where is the un-installer ? How does it add link to Windows "Add remove programs" ?
What am i missing here?
On install i need to copy the file and then to stop/start a certain service.
On Un-install i need to remove that file+folder and then to stop/start a certain service.
Thanks
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="325c4bfd-6614-43e9-aedb-93661295352d" Name="install" Language="1033" Version="1.0.0.0" Manufacturer="install" UpgradeCode="4307526e-3902-40d0-991b-bacff9b3d71b">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="APPDIR">
<RegistrySearch Id="APPDIRECTORY" Type="raw" Root="HKLM" Key="SOFTWARE\APP\APPInstalPath" Name="InstallationPath" />
</Property>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="APPDIR">
<Component Id="ProductComponent" Guid="93118c45-f0c0-4c9e-9168-8ea905e9427c">
<File Id="pluggin" Source="C://setup.log" KeyPath="yes" Checksum="yes"/>
</Component>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="install" Level="1">
<ComponentRef Id="ProductComponent" />
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
</Wix>
The listing in Add/Remove programs is whatever Name you specified in the Product tag. In your case, the name in Add/Remove programs is install:
<Product Id="325c4bfd-6614-43e9-aedb-93661295352d" Name="install"

Resources