[wix-users] Unable to assign Auto Generated GUID for Component ID for Empty Folder
Edwin Castro
egcastr at gmail.com
Tue Apr 12 10:35:18 PDT 2022
Heat does not support auto generation of GUID for an empty directory as the
error message indicated. You cannot coerce it to do so. You can put a file
in the "empty" directory, but then it is no longer empty isn't it.
You could use XSLT to transform the generated .wxs source *but* you'd have
to generate the GUID yourself anyway and figure out some method to keep it
consistent between regenerations to ensure the component rules are not
broken. In fact, generating a consistent GUID for an empty directory is
difficult because of a lack of data to use to make it consistent. That's
the reason heat doesn't do it for you already. The effort spent trying to
solve this problem might be better spent hardcoding your empty directories
or ensuring each directory has at least one file in it that is installed by
the MSI so heat can auto generate your GUID.
Alternatively, the application itself could create the Logs directory on
its own at runtime. The installer could delete the files inside the Logs
directory and the Logs directory at uninstall if that's why you want the
installer to create the empty directory to begin with. If you need to do
this conditionally, then you could use a semi-custom action to populate the
appropriate table with an immediate custom action depending on your
specific conditions.
https://www.joyofsetup.com/2007/07/01/semi-custom-actions/
I don't really know what the real goal is behind installing an empty
directory so I can't offer other suggestions.
--
Edwin G. Castro
On Tue, Apr 12, 2022 at 9:03 AM Venkatesh H <venh.123 at gmail.com> wrote:
> Thanks a lot Edwin. But, I wanted to harvest an empty folder and be able
> to auto generate the component guid.
>
>
> On Tue, Apr 12, 2022 at 4:04 AM Edwin Castro <egcastr at gmail.com> wrote:
>
>> Consider not harvesting the empty directory and adding an authored
>> component instead.
>>
>> <Fragment>
>> <DirectoryRef Id="MYFOLDER">
>> <Directory Id="LogsFolder" Name="Logs" />
>> </DirectoryRef>
>> <Component Id="CmpLogsFolder" Guid="ENTER_REAL_GUID_HERE"
>> Directory="LogsFolder>
>> <CreateFolder />
>> </Component>
>> </Fragment>
>>
>> Then make sure to add an appropriate ComponentRef to your Feature.
>>
>> <Feature ...>
>> <ComponentRef Id="CmpLogsFolder" />
>> <ComponentGroupRef Id="MyCompGroup" />
>> </Feature
>>
>> --
>> Edwin G. Castro
>>
>> On Mon, Apr 11, 2022 at 5:02 AM Venkatesh H via wix-users <
>> wix-users at lists.wixtoolset.org> wrote:
>>
>>> In my Visual Studio Wix Project, I have a Heat command used to harvest a
>>> directory in PreBuild Event.
>>>
>>> *"%wix%bin\heat.exe" dir "%MyFolderPath%" -out
>>> "$(ProjectDir)Files\HeatOutput.wxs" -cg MyCompGroup -pog -gg -ag -g1 -ke
>>> -sfrag -sreg -srd -dr MYFOLDER*
>>>
>>> In my folder to harvest, I added an empty folder called Logs. Then when I
>>> ran the build, I got the following error.
>>>
>>>
>>>
>>> *The Component/@Guid attribute's value '*' is not valid for this
>>> component
>>> because it does not meet the criteria for having an automatically
>>> generated
>>> guid. Components using a Directory as a KeyPath or containing
>>> ODBCDataSource child elements cannot use an automatically generated guid.
>>> Make sure your component doesn't have a Directory as the KeyPath and move
>>> any ODBCDataSource child elements to components with explicit component
>>> guids.*
>>>
>>> So, can I not harvest an empty folder and have an auto generated
>>> Component
>>> ID? Please help me fix this.
>>>
>>> *Environment Details*
>>> Visual Studio 2019 Professional
>>> WiX Tool Set 3.11.2
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>
More information about the wix-users
mailing list