I want add some extension after installation, so tried to add custom action for adding extension in using Wix but now I want remove the folder when performing uninstall action extension folder is not getting removed.
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="TargetProgram" Guid="f757ff43-0266-483a-8749-ec796cba4b25" >
<File Id="EXE" Source="C:\Windows\System32\cmd.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="SetTARGETDIR"
Directory="TARGETDIR"
Value="Pathtoextensionadd"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetTARGETDIR" Before="InstallFinalize">Installed </Custom>
</InstallExecuteSequence>
<CustomAction Id='EXECUTE_AFTER_FINALIZE'
Directory='TARGETDIR'
Impersonate='yes'
Execute='deferred'
ExeCommand='command line argument that install extension in "Pathtoextensionadd"' Return='check' />
<InstallExecuteSequence>
<Custom Action="EXECUTE_AFTER_FINALIZE" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
Installation is done correctly.
How can I remove that "Pathtoextensionadd" folder?
<?define AppCacheFolder ="Pathtoextensionadd" ?>
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Component Id="CacheCleanup" Guid="">
<RegistryValue Root="HKCU"
Key="$(var.AppRegKey)"
Name="CachePath"
Type="string"
Value="$(var.AppCacheFolder)"
KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="CACHEFOLDER" />
</Component>
</DirectoryRef>
</Fragment>
below code added under Product Tag
<?define AppRegKey ="RegPath" ?>
<Property Id="CACHEFOLDER">
<RegistrySearch Key="$(var.AppRegKey)"
Root="HKCU"
Type="raw"
Id="CacheFolderRegSearch"
Name="CachePath" />
</Property>
under feature tag
<ComponentRef Id="CacheCleanup" />
Related
I have tried for 10 hours million things but I don't get it to work. Here is my code (extract):
<Fragment>
<util:RegistrySearch Id="VC_REDIST_Version"
Root="HKCR"
Variable="VCREDIST143431931"
Key="Installer\Dependencies\VC,redist.x86,x86,14.34,bundle"
Format="raw"
Value="Version"
Result="value" />
<ComponentGroup Id="ThirdPartyComponents" Directory="ExtSources">
<Component Id="Component_VC_redist_x86" Guid="2B80F89A-990A-438E-A475-9E72d8A0198A" >
<File Id="ExtSources_VC_redist.x86.exe" Name="VC_redist.x86.exe" Source="$(var.xxxxx_TargetDir)ExtSources\VC_redist.x86.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="Install_VC_redist_x86"
Execute="immediate"
Impersonate="no"
Return="asyncNoWait"
FileKey="ExtSources_VC_redist.x86.exe"
ExeCommand="" />
<InstallExecuteSequence>
<Custom Action="Install_VC_redist_x86" After="InstallFinalize">NOT VCREDIST143431931</Custom>
</InstallExecuteSequence>
</Fragment>
But the problem is that the Custom action is executed always, independent from the state.
Any Idea what might be wrong?
UPDATE:
This is now how I did it and it works including skipping calling the installer when there is already a newer or same version of vc distrib installed:
<Fragment>
<Property Id="VCREDISTINSTALLED">
<RegistrySearch Id="VCRedistInstalledSearch"
Root="HKCR"
Key="Installer\Dependencies\VC,redist.x86,x86,14.34,bundle"
Name="Version"
Type="raw"
Win64="no"/>
</Property>
<ComponentGroup Id="ThirdPartyComponents" Directory="ExtSources">
<Component Id="Component_VC_redist_x86" Guid="2B80F89A-990A-438E-A475-9E72d8A0198A" >
<File Id="ExtSources_VC_redist.x86.exe" Name="VC_redist.x86.exe" Source="$(var.xxxxx_TargetDir)ExtSources\VC_redist.x86.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="Install_VC_redist_x86"
Execute="immediate"
Return="asyncNoWait"
FileKey="ExtSources_VC_redist.x86.exe"
ExeCommand="/quiet /norestart" />
<InstallExecuteSequence>
<Custom Action="Install_VC_redist_x86" After="InstallFinalize"><![CDATA[VCREDISTINSTALLED < "14.34.31931.0" AND NOT REMOVE]]></Custom>
</InstallExecuteSequence>
</Fragment>
You'll want to use RegistrySearch instead of util:RegistrySearch. The util:RegistrySearch is only recognized in Bundles. In WiX v4, there is a error message but in WiX v3 it is silently ignored.
I have an issue with adding html show up in my WiX bundle. Have you any idea how to make it?
Second way how u can resolve it is by open default browser
<Property Id="BROWSER">
<RegistrySearch Id='DefaultBrowser' Type='raw' Root='HKCR' Key='http\shell\open\command' />
</Property>
<CustomAction Id="LaunchBrowser" Directory="INSTALLDIR" Impersonate="no" Execute="deferred"
ExeCommand='[BROWSER] "file://[InputResourcesDir]html.html"' Return="asyncNoWait"/>
<InstallExecuteSequence>
<Custom Action='LaunchBrowser' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<Directory Id="InputResourcesDir" Name="resource">
<Component Id="index.html" Guid="{EE71FB84-2328-474E-9E5C-A29D2AD6EFD5}">
<File Id="filEE71FB842328474E9E5CA29D2AD6EFD5"
Source="$(var.project.path)/$(var.project.resourceDir)/index.html" />
</Component>
</Directory>
<Feature Id>
<ComponentRef Id="index.html"/>
</Feature>
First way i have resolved is using internal WiX dll WixShellExec
<Property Id="WixShellExecTarget" Value="[InputResourcesDir]index.html" />
<CustomAction Id="OpenHtmlPage" BinaryKey="WixCA" DllEntry="WixShellExec" />
<InstallExecuteSequence>
<Custom Action='OpenHtmlPage' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<Directory Id="InputResourcesDir" Name="resource">
<Component Id="index.html" Guid="{EE71FB84-2328-474E-9E5C-A29D2AD6EFD5}">
<File Id="filEE71FB842328474E9E5CA29D2AD6EFD5"
Source="$(var.project.path)/$(var.project.resourceDir)/index.html" />
</Component>
</Directory>
<Feature Id>
<ComponentRef Id="index.html"/>
</Feature>
but this way has a problem, bcs html page is opened by default application (Notepad, Sublime, Chrome etc) that obviosly maybe will not be a browser.
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.
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
I'm using WiX to create my products installer. For some reason it's no longer embedding the .exes and .dlls inside the installer. So I have this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="USERSPECIFIEDDIR" Name="My-app-name" />
</Directory>
and it creates a .msi alongside a folder called My-app-name that contains all .exe and dll files required for the application. if i run the installer from there, it's alright, but if i move the msi elsewhere (without the subdirectory), it errors out because it can't find the files. how can i tell WiX to embed all binaries inside the installer??
in case it helps, here are some other snippets from my wxs. let me know if you need any other information. oh, and i'm using wix directly from visual studio 2008.
<DirectoryRef Id="USERSPECIFIEDDIR">
<Component Id="MainExe" Guid="580F8F15-C06C-49A7-ADDC-56C96580DC0D">
<File Id="MainExe" Name="OrderMonkey.exe" KeyPath="yes" />
</Component>
<Component Id="OMEmailerExe" Guid="3B0AECC3-67E5-40B3-83CB-9B84FE965ED8">
<File Id="OMEmailerExe" Name="OMEmailer.exe" />
</Component>
<Component Id="migradomDLL" Guid="37E1BCAE-EB39-4DF5-88C7-AE74CA5EA171">
<File Id="migradom" Name="MigraDoc.DocumentObjectModel.dll" />
</Component>
<Component Id="migrarenderDLL" Guid="C2910B9E-0B06-467A-853C-7651BE7BD9E4">
<File Id="migrarender" Name="MigraDoc.Rendering.dll" />
</Component>
<Component Id="migrartfDLL" Guid="CEBE4DE9-7CA0-4F48-A8B1-1D46E4E48B66">
<File Id="migrartf" Name="MigraDoc.RtfRendering.dll" />
</Component>
<Component Id="mysqldataDLL" Guid="2E474737-474C-4146-8E67-D3837B5DB862">
<File Id="mysqldata" Name="MySql.Data.dll" />
</Component>
<Component Id="pdfchartingDLL" Guid="7467B6C2-BE38-4283-B179-9FA94C4A087F">
<File Id="pdfcharting" Name="PdfSharp.Charting.dll" />
</Component>
<Component Id="pdfsharpDLL" Guid="39F23E36-BF9C-40C1-8190-6A3554B879BC">
<File Id="pdfsharp" Name="PdfSharp.dll" />
</Component>
<Component Id="sqliteDLL" Guid="B043CF20-8DC2-4A10-AE4B-4721263A111E">
<File Id="sqlite" Name="System.Data.SQLite.dll" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="414E91FD-7410-492C-9D48-8125C6ECCF0B">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Order Monkey"
Description="Order Monkey Orders and Quotes"
Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
WorkingDirectory="USERSPECIFIEDDIR" />
<Shortcut Id="ApplicationOfflineStartMenuShortcut"
Name="Order Monkey Offline"
Description="Order Monkey Orders and Quotes"
Target="[USERSPECIFIEDDIR]OrderMonkey.exe"
WorkingDirectory="USERSPECIFIEDDIR"
Arguments="-offline" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\OrderMonkey" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id='Complete' Level='1' Title='Order Monkey Complete' Description='The complete package' ConfigurableDirectory='TARGETDIR' Display='expand'>
<ComponentRef Id='MainExe' />
<ComponentRef Id='OMEmailerExe' />
<ComponentRef Id='migradomDLL' />
<ComponentRef Id='migrarenderDLL' />
<ComponentRef Id='migrartfDLL' />
<ComponentRef Id='mysqldataDLL' />
<ComponentRef Id='pdfchartingDLL' />
<ComponentRef Id='pdfsharpDLL' />
<ComponentRef Id='sqliteDLL' />
<ComponentRef Id='ApplicationShortcut' />
<ComponentRef Id='AppData' />
</Feature>
Use these elements:
<Package Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
Package/#Compressed="yes" creates cabinets instead of loose files. MediaTemplate/#EmbedCab="yes" embeds the default cabinets into the .msi.