.wxs only two file not getting deleted on uninstall - wix3.5

I am using wix installer for msi.
i am using default UI
<UIRef Id="WixUI_Minimal"/>
There are somany dll i am using for msi package. on installation all dll will be installed at
C:\Program Files (x86)\MyApp
while on uninstall all dll uninstalled or deleted except two dll
libssl-1_1.dll
libcrypto-1_1.dll
I found that identifier '-' is making problem on uninstalling and not getting deleted.
I tried custom action like this for deleting that folder itself, but it didn't work.
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id="ALLUSERSPROFILE" SourceName="All Users" />
<Directory Id='ProgramFilesFolder' SourceName="program files">
<Directory Id="INSTALLDIR" Name="MyApp" >
<Component Id="First.dll" Guid="GUID">
<File Id="first.dll" Name="first.dll" KeyPath="yes" Vital="no" Source="$(var.PATH)\first.dll" />
</Component>
....... All dll component place like above ......
</Directory>
</Directory>
</Directory>
<Property Id="INSTALLDIR">
<RegistrySearch Root="HKLM" Key="SOFTWARE\MyProj\MyApp" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
</Property>
<DirectoryRef Id='INSTALLDIR'>
<Component Id="UninstallFolder" Guid="*">
<CreateFolder Directory="INSTALLDIR"/>
<util:RemoveFolderEx Property="INSTALLDIR" On="uninstall"/>
<RemoveFolder Id="INSTALLDIR" On="uninstall"/>
<RegistryValue Root="HKLM" Key="SOFTWARE\MyProj\MyApp" Name="path" Type="string" Value="[ProgramFilesFolder]MyApp " KeyPath="yes"/>
</Component>
</DirectoryRef>

Related

ICE91 Wix in perMachine Installer

I am trying to make a perMachine Installer that is able to create files and folders in the PersonalFolder and LocalAppDataFolder of each user. I am getting always the warning message "warning LGHT1076: ICE91: ..." as listed below. When I install as an Administrator the file and folder is created despite the warning, but when I try the installer as standard user no file and no folder is created on the user profile. What could be the solution?
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="PFInstallDir" Name="Example">
<Component Id="ApplicationFiles" Guid="12345678-1234-1234-1234-222222222222">
<File Id="ApplicationFile1" Source="notepad.exe"/>
</Component>
</Directory>
</Directory>
<Directory Id="CommonFilesFolder">
<Directory Id="CFInstallDir" Name="Example">
<Component Id="CommonApplicationFiles" Guid="12345678-1234-1234-1234-222222222223">
<File Id="ApplicationFile2" Source="notepad.exe"/>
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="CAInstallDir" Name="Example">
<Component Id="CommonAppDataApplicationFiles" Guid="12345678-1234-1234-1234-222222222224">
<File Id="ApplicationFile3" Source="notepad.exe"/>
</Component>
</Directory>
</Directory>
<Directory Id="PersonalFolder">
<Directory Id="InstallDirPersonal" Name="ExampleDocs">
<Component Id="ApplicationPersonalFiles" Guid="12345678-1234-1234-1234-222222222225">
<CreateFolder />
<RemoveFolder Id="RemoveMyExampleDir1" On="uninstall" Directory="InstallDirPersonal"/>
<RegistryKey Root="HKCU" Key="Software\MyCompany\Documents">
<RegistryValue Name="MainExe" Value="1" KeyPath="yes" Type="integer" />
</RegistryKey>
<File Id="Notepad.MyExe"
Source="notepad.exe" DiskId="1" Checksum="yes">
</File>
</Component>
</Directory>
</Directory>
<Directory Id="LocalAppDataFolder" Name="AppData">
<Directory Id="InstallDirAppDataPersonal" Name="ExampleLocals">
<Component Id="ApplicationPersonalDataFiles" Guid="12345678-1234-1234-1234-222222222226">
<CreateFolder />
<RemoveFolder Id="RemoveMyExampleDir" On="uninstall" Directory="InstallDirAppDataPersonal"/>
<RegistryKey Root="HKCU" Key="Software\MyCompany\Example">
<RegistryValue Name="MainExe" Value="1" KeyPath="yes" Type="integer" />
</RegistryKey>
<File Id="Notepad.MyExe1"
Source="notepad.exe" DiskId="1" Checksum="yes">
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles"/>
<ComponentRef Id="CommonApplicationFiles"/>
<ComponentRef Id="CommonAppDataApplicationFiles"/>
<ComponentRef Id="ApplicationPersonalDataFiles"/>
<ComponentRef Id="ApplicationPersonalFiles"/>
</Feature>
</Product>
-- Build started: Project: SetupProjectPerUsrMachine, Configuration: Debug x86 --
warning LGHT1076: ICE91: The file 'Notepad.MyExe' will be installed to the per user directory 'InstallDirPersonal' that doesn't vary based on ALLUSERS value. This file won't be copied to each user's profile even if a per machine installation is desired.
warning LGHT1076: ICE91: The file 'Notepad.MyExe1' will be installed to the per user directory 'InstallDirAppDataPersonal' that doesn't vary based on ALLUSERS value. This file won't be copied to each user's profile even if a per machine installation is desired.
Problem solved!
http://www.installworld.com/index.php?option=com_content&do_pdf=1&id=146
"If the resource must be copied to each user’s profile, then add functionality to your package to do this. To achieve this, add a current user registry key (i.e., just a dummy registry key) and make this registry key the key path of the component which contains the resource. This means that the resource will be copied to the next user’s profile as part of the MSI self healing mechanism, provided that advertised entry points exist for the product."
http://blog.bittercoder.com/2007/02/28/wix-shortcuts/
<Component Id="StandAloneApplication" Guid="C8D5DB05-2D68-40e8-88D1-EF5BEA18DBE1">
<File Id="SomeCompanySomeProductHostApp"
Name="SomeCompany.SomeProduct.HostApp.exe"
DiskId="1"
Source="....buildSomeCompany.SomeProduct.HostApp.exe"
Vital="yes">
<Shortcut Advertise="yes"
Id="SomeCompanySomeProductHostAppShortcut"
Directory="ProgramMenuDir"
Name="My Product"
WorkingDirectory="INSTALLDIR"
Description="SomeProduct Application"
Icon="HostAppShortcutIcon.exe">
<Icon Id="HostAppShortcutIcon.exe"
SourceFile="....buildSomeCompany.SomeProduct.HostApp.exe" />
</Shortcut>
</File>
</Component>

How to add to PATH variable with a WIX for everyone: admin and standard users?

I'm trying to set a global PATH environment variable along with my custom variable using WIX installer. I do the following:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="COMPANYFOLDER" Name="my company">
<Directory Id="INSTALLFOLDER" Name="app name">
<!-- blah blah -->
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="TARGETDIR">
<!-- Add environment variables -->
<Component Id="idPathEnvSys" Guid=".....">
<Environment Id="idEnvPathSys" Name="PATH" Action="set" Part="last" System="yes" Value="[INSTALLFOLDER]" Permanent="no"/>
</Component>
<Component Id="idPathEnvUsr" Guid=".....">
<Environment Id="idEnvPathUsr" Name="PATH" Action="set" Part="last" System="no" Value="[INSTALLFOLDER]" Permanent="no"/>
</Component>
<Component Id="EnvVarsSys" Guid=".....">
<Environment Id="idEnvMyPathSys" Name="MYPATH" Value="[INSTALLFOLDER]" Part="all" System="yes" Action="set" Permanent="no" />
</Component>
<Component Id="EnvVarsUsr" Guid="....">
<Environment Id="idEnvMyPathUsr" Name="MYPATH" Value="[INSTALLFOLDER]" Part="all" System="no" Action="set" Permanent="no" />
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="!(loc.ProductName)" Level="1">
<!-- main components first -->
<ComponentRef Id='idPathEnvSys' />
<ComponentRef Id='idPathEnvUsr' />
<ComponentRef Id='EnvVarsSys' />
<ComponentRef Id='EnvVarsUsr' />
</Feature>
It compiles just fine but when I install it, for some reason it only adds the system variable. So in other words, if I run a command prompt as admin and do set path it shows my PATH addition. But when I do the same from a regular user account, it is not there.
What am I missing?

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 - The directory is in the user profile but is not listed in the RemoveFile table

I want to create a subfolder in start menu, in my case PMFCompanyFolder already exists and contains links and I don't want remove when uninstalling my product.
So I don't push the RemoveFolder Property and I get :
ICE64: The directory PMFCompanyFolder is in the user profile but is not listed in the RemoveFile table.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="PMFCompanyFolder" Name="MyCompany">
<Directory Id="PMFProductFolder" Name="MyProduct"/>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="PMFProductFolder">
<Component Id="PMFProductFolderComponent" Guid="A13A7784-4C82-4CBE-9018-CEC6F266743B">
<RemoveFolder Id="null" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\MyCompany\MyProduct" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="" Level="1">
<ComponentRef Id="PMFProductFolderComponent"/>
</Feature>
You should pass the folder id:
<RemoveFolder Id="PMFCompanyFolder" On="uninstall"/>
It is safe to remove it on uninstall - pre-existing items will not be removed.

Wix Directory Problems

I have two questions about the directories with using fragments in Windows Installer XML.
I got this fragment file from the heat.exe:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dir08A07F5561FBEB6B9772467C730F6445" Name="Test" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="InstallationFiles">
<Component Id="cmp071F7F8F6B6027C8D2841272FE526A2B" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{CCCB70AC-29F5-4DAA-B03E-1A2266649AB6}">
<File Id="fil63087E96FFB31F9E39B642CE8914F48B" KeyPath="yes" Source="SourceDir\dmedv.jpg" />
</Component>
<Component Id="cmpAE6CBEDA75641CF25BA9996AEB74A0DE" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{F5DABCAB-95D1-4197-A49F-E5F052A8E7EF}">
<File Id="filD27F2F6B26F5C14563865FE6C2AD5D50" KeyPath="yes" Source="SourceDir\Files.txt" />
</Component>
<Component Id="cmp25C5EADB5C0A9E779D20EC7B77BD42B0" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{E301B04A-6EA5-496B-A58A-8898110BE57C}">
<File Id="fil7C91C48D9AA0F2FE0EB37A21F108037F" KeyPath="yes" Source="SourceDir\readme.txt" />
</Component>
<Component Id="cmpD387AB4B40EDF14BF271ADDA7B71D2B7" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{6AF61DF4-32D0-4E7C-95B8-1DB9E7409029}">
<File Id="fil966691BA382AFC9343430FE162643432" KeyPath="yes" Source="SourceDir\readme1.txt" />
</Component>
<Component Id="cmpB86212407C1BEA12838C8C7B20495E9F" Directory="dir08A07F5561FBEB6B9772467C730F6445" Guid="{921E971E-E224-464C-9FBC-FBC5F78B3E5B}">
<File Id="fil61CD8EF43EA29DF58454E9A19F8C1EF9" KeyPath="yes" Source="SourceDir\readme2.txt" />
</Component>
<Component Id="cmpE4143B48FF854AE84F6054D4636FDE81" Directory="dir0ADF7E89B935DD39670130B4DC1D670E" Guid="{6F248718-93DD-4850-A18E-BD7079F738D5}">
<File Id="fil03847B355B6AADE5E4E04D143C92BC67" KeyPath="yes" Source="SourceDir\Test2\dmedv2.jpg" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="dir08A07F5561FBEB6B9772467C730F6445" />
</Fragment>
<Fragment>
<DirectoryRef Id="dir0ADF7E89B935DD39670130B4DC1D670E" />
</Fragment>
<Fragment>
<DirectoryRef Id="dir08A07F5561FBEB6B9772467C730F6445">
<Directory Id="dir0ADF7E89B935DD39670130B4DC1D670E" Name="Test2" />
</DirectoryRef>
</Fragment>
</Wix>
and I have this wix installer file:
<?xml version='1.0' encoding='windows-1252'?>
<?define ProductVersion="1.0.0.0"?>
<?define ProductName="DMServices Installer"?>
<?define Manufacturer="DM EDV- und Bürosysteme GmbH"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
<Product Name="$(var.ProductName)" Id='BB7FBBE4-0A25-4cc7-A39C-AC916B665220' UpgradeCode='8A5311DE-A125-418f-B0E1-5A30B9C667BD'
Language='1033' Codepage='1252' Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)">
<Package Id='*' Keywords='Installer'
Description="DMService Installer Setup"
Manufacturer='DM EDV- und Bürosysteme GmbH'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="the man" />
<PropertyRef Id="NETFRAMEWORK35"/>
<Condition Message='This setup requires the .NET Framework 3.5.'>
<![CDATA[Installed OR (NETFRAMEWORK35)]]>
</Condition>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder'>
<Directory Id='DM' Name='DM EDV'>
<Directory Id='INSTALLDIR' Name='DMServices'>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='InstallationFiles' Title='InstallationFiles' Level='1'>
<ComponentGroupRef Id='InstallationFiles' />
</Feature>
</Product>
</Wix>
So far.
Now when i generate this files to wixobj, the compiler shows errors because the files can't be found. The files are in a directory called "Test". And in the file it's named SourceDir.
For a lil workaround i can copy the test directory and call it SourceDir ;-). So my Setup will be created.
How can I do it without a second directory?
EDIT: Problem is done.
Now i install my package. But whatever i do, the files will be installed to C:\Test.
But I want it to be installed in my Program Files Directory.
In many examples i can do it, like in the file, but i have to know the guids.
But we do wix for getting all files from one directory, without to put our hands on.
So how to install the files into the program files directory?
Take a closer look at -dr switch of heat.exe. You can put the necessary directory reference there. So, define your directory structure in the main file as you do now, and provide correct directory ID to heat.exe.
UPDATE:
Ok, the following works for me. The main directory structure:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLLOCATION" Name="My folder">
<Directory Id="WebsiteFolder" Name="Website">
...
</Directory>
</Directory>
</Directory>
The Feature references the ComponentGroup:
<Feature Id="ProductFeature" Title="!(loc.ProductFeature.Title)" Level="100">
...
<ComponentGroupRef Id="WebsiteFolderComponentGroup"/>
...
</Feature>
The heat.exe generates the following fragment:
<Fragment>
<DirectoryRef Id="WebsiteFolder">
<Component Id="cmp1" Guid="GUID-GOES-HERE">
<File Id="fil1" KeyPath="yes" Source="$(var.WebsiteFolderSource)\Default.aspx" />
</Component>
<Component Id="cmp2" Guid="GUID-GOES-HERE">
<File Id="fil2" KeyPath="yes" Source="$(var.WebsiteFolderSource)\default.css" />
</Component>
<Directory Id="dir1" Name="App_Browsers">
<Component Id="cmp3" Guid="GUID-GOES-HERE">
<File Id="fil3" KeyPath="yes" Source="$(var.WebsiteFolderSource)\App_Browsers\Form.browser" />
</Component>
</Directory>
<Directory Id="App_Config" Name="App_Config">
<Component Id="cmp4" Guid="GUID-GOES-HERE">
<File Id="fil4" KeyPath="yes" Source="$(var.WebsiteFolderSource)\App_Config\ConnectionStrings.config" />
</Component>
</Directory>
<Directory Id="bin" Name="bin">
<Component Id="cmp5" Guid="GUID-GOES-HERE">
<File Id="fil5" KeyPath="yes" Source="$(var.WebsiteFolderSource)\bin\MySystem.Web.UI.dll" />
</Component>
<Component Id="cmp6" Guid="GUID-GOES-HERE">
<File Id="fil6" KeyPath="yes" Source="$(var.WebsiteFolderSource)\bin\Another.dll" />
</Component>
...
</Directory>
...
</Directory>
...
<ComponentGroup Id="WebsiteFolderComponentGroup">
<ComponentRef Id="cmp1" />
<ComponentRef Id="cmp2" />
<ComponentRef Id="cmp3" />
<ComponentRef Id="cmp4" />
...
</ComponentGroup>
And finally, the heat command which generates necessary output looks like this (Nant sample):
<exec program="heat.exe" verbose="true" basedir="${paths.source}">
<arg line='dir "${paths.dist.website}"'/><!-- Notice the quotes inside the attributes -->
<arg line='-srd'/>
<arg line='-dr WebsiteFolder'/>
<arg line='-cg WebsiteFolderComponentGroup'/>
<arg line='-out "${paths.harvest}\website.wxs"'/>
<arg line='-ke -sfrag -scom -sreg -gg'/>
<arg line='-var var.WebsiteFolderSource'/>
</exec>
These snippets contain enough information to understand how it all works. Play with heat.exe switches to find out the combination you need. Good luck!
In case people like me still looking for clarification: The <DirectoryRef Id="WebsiteFolder"> in the heat fragment is important, it is the reference to where the fragment files should be installed. If you have multiple fragments and want to place it in different locations, the DirectoryRef is the key.

Resources