Harvesting files leads to LGHT0231 error
Asked Answered
U

1

13

I'm using latest votive (Wix v3.5) and created a simple Wix VS 2010 setup project. I added my website reference and set the Harvest option as true.

Now since my INSTALLDIR points to a folder under IISROOT, I get this light.exe error:

[filepath]: error LGHT0231: The component 'cmp93982C4086FF8C75F07339DD7CEA8152' has a key file with path 'TARGETDIR\webdir...[filename].xml'. Since this path is not rooted in one of the standard directories (like ProgramFilesFolder), this component does not fit the criteria for having an automatically generated guid. (This error may also occur if a path contains a likely standard directory such as nesting a directory with name "Common Files" under ProgramFilesFolder.)

While I understand the reason behind this error, I don't necessarily agree to its rational (maybe I don't understand the innate workings of Wix MSI generation).

How can I resolve this error?


To provide some context:

I'm trying to set this up in conjunction with Team Build. I can use the legacy format and run Heat/Harvest task against a folder to bypass this issue but do not want to go the legacy route.

I have not played enough with the new workflow based build definition, so not sure how I can incorporate this custom task.

I need to run harvest every time the Setup project is built because I do not want to keep track of hundreds of files manually.

Ushas answered 7/9, 2011 at 4:5 Comment(10)
I have the same issue; I'm trying to set C:\Inetpub\wwwroot\MyProject\ as the default installation location, but WiX won't hear of it.Eldest
Have you found some workaround? ThanksCording
@SanjaMelnichuk: Unfortunately not. I haven't invested more time there too as I moved to other projects but I guess what I'm trying to do there would require some XAML knowledge and familiarity with TFS workflows.Ushas
@Ushas Finally i found workaround solution. Thanks for responseCording
@SanjaMelnichuk: Care to share? :)Ushas
In case any one met with the same problem, Directory/@ComponentGuidGenerationSeed property can be used to solve it. You could find its document here wix.sourceforge.net/manual-wix3/wix_xsd_directory.htm. BTW, I am using Wix v3.6, and I am not sure whether it works with older versions.Kozlowski
I don't really understand what your meaning. Could you post your solution? I have to set my target dir to C:\inetpub\wwwroot and this must also be changeable by command prompt. Can you help me?Rennin
@wenqiang's answer is correct; component guids can only be generated automatically if the component is contained in a well-known folder such as ProgramFilesFolder, because the guid is a version-5 UUID using the directory as the seed so the UUID can be re-generated consistently. Adding Directory/@ComponentGuidGenerationSeed overrides this and uses this value for the generation instead, so it's now up to the Wix author to keep the component guid consistent (by not changing the value).Toilsome
duplicate of #28182001Adali
This question was posted 3 years before the one you linked @johnktejik :)Ushas
T
15

The problem is because the component is rooted in TARGETDIR, which WiX cannot use for automatically generating a guid. You can add Directory/@ComponentGuidGenerationSeed to a directory above this component to avoid the problem. By adding this attribute, you must now take responsibility for ensuring the component doesn't get installed to two different directories across upgrades.

In Windows Installer, components need to have a guid that doesn't change between patches, minor upgrades, and major upgrades. As a convenience, WiX can generate a version 5 UUID for you using the component's directory hierarchy as the seed. But, TARGETDIR is ineligible for this.

I believe the reason is that TARGETDIR changes across installations (it's set to the drive that has the most free space). One of the component rules is "each component must be stored in a single folder". If TARGETDIR changed between major upgrades, then you could end up trying to install the same component to a second folder.

Toilsome answered 10/9, 2013 at 8:27 Comment(3)
Wasn't until I was authoring another Wix project that I ran into this again and then I remembered your solution. Sorry it took me so long to accept it! :)Ushas
I don't get this. What if the GUID you generate already exists on the users machine?Adali
@johnktejik That would be bad, but the odds of accidentally generating a GUID collision are so astronomical that it's probably not worth worrying about.Toilsome

© 2022 - 2024 — McMap. All rights reserved.