So I'm trying to install a web application and I stumbled upon this question: Using WiX to create an IIS virtual directory. When I try to adapt this for my own app, I get an error:
W:\projectlocation\IssInstallationComponents.wxs(6,0): error LGHT0204: ICE18: KeyPath for Component: 'SiteInstallationComponent' is Directory: 'WEBDIRECTORY'. The Directory/Component pair must be listed in the CreateFolders table.
I'm stuck trying to figure this out. Here's what I have in the affected file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Fragment>
<DirectoryRef Id="WEBDIRECTORY">
<Component Id="SiteInstallationComponent" Guid="MY GUID">
<iis:WebVirtualDir Id="ProductVirtualDirectory" Alias="[PRODUCTVERSION]" Directory="WEBDIRECTORY" WebSite="DefaultWebSite"/>
</Component>
</DirectoryRef>
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site' Directory='WEBDIRECTORY'>
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
</Fragment>
</Wix>
A couple of notes on my example. First, I know that the GUID is wrong, I removed it from the sample above so that it doesn't get indexed by google and reused by someone looking to figure out something similar. In my code, I have a correct GUID. I also changed the product name to "Product" to avoid any kind of IP issues.
Any ideas on what I need to do to get this code working?
sigh
Okay, I went digging through the interwebs and found the following thread: http://www.mail-archive.com/[email protected]/msg03483.html
Basically I need to change my component so that it looks like this:
<Component Id="SiteInstallationComponent" Guid="MY GUID">
<CreateFolder />
<iis:WebVirtualDir Id="ProductVirtualDirectory" Alias="[PRODUCTVERSION]" Directory="WEBDIRECTORY" WebSite="DefaultWebSite"/>
</Component>
I love Wix, but sometimes it drives me crazy.
Thought I'd add a bit to this. In my case I needed to modify a config file as part of a patch with an XmlConfig action. I ran into the original problem and also tried to work around it by just sticking a CreateFolder element in there. But there's a hitch with that. If your component is part of a patch, putting a CreateFolder entry in there makes it not uninstallable. That means you can't roll back the patch.
What I ended up doing was creating a different KeyPath for the component. I gave it a registry key as the KeyPath and it stopped bothering me about the CreateFolder entry. This means that it will do whatever you want it to do on install and uninstall and use the registry key you gave it to track whether or not the component is installed.
<RegistryKey Root="HKLM" Key="[REGISTRYKEY]\Settings\[TITLE]" Action="createAndRemoveOnUninstall">
<RegistryValue Action="write" Type="integer" Name="MACHINEMEMORYLIMIT" Value="1" KeyPath="yes"/>
</RegistryKey>
(In this case REGISTRYKEY and TITLE are two properties we passed into the installer)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With