8
votes

WiX is complaining (what are the odds, right?):

Error 95 The component 'blahblah' has a key file with path 'TARGETDIR\blah.dll'. 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.)

But I WANT an automatically generated GUID, and I DON'T want to have to set the TARGETDIR to some other path comprised of ProgramFilesFolder since I am setting the TARGETDIR in the UI and I even allow the user to change it so that people can specify the path they want to install the application at...how does someone get this functionality? Is it possible? I mean, can I have the best of both worlds or not? Why is it such a big deal? WiX is way too restrictive sometimes...

2
WiX isn't complaining, Windows Installer is complaining. It's a big deal because the underlying Windows Installer has something called the component rules. Bad things happen when you break them.Christopher Painter
Then don't use MSI. I understand your frustration... I spent a lot of time fighting MSI when I first learned it. It's a very rigid framework that doesn't like you coloring outside of the lines. But once you master it, there is a huge net gain in terms of developer productivity and quality of user experience.Christopher Painter
Unfortunately its a standard that people have come to grips with, otherwise I wouldn't use it :)Alexandru
BTW, I misspoke. That is WiX complaining. I misread the message.Christopher Painter
@ChristopherPainter Either way, it doesn't matter who's complaining, what matters is that there was a solution to this all.Alexandru

2 Answers

9
votes

All you need to do is set Directory/@ComponentGuidGenerationSeed and then you can use auto guids for non-standard folder.

-1
votes

I just got it...kind of annoying but its working alright...

I was modifying the TARGETDIR and working with it prior...but now, I realize that I can easily just have worked with INSTALLDIR...for example, I re-factored my directory structure as such:

<Directory Id='TARGETDIR' Name='SourceDir'>
  ...
  <Directory Id="ProgramFilesFolder">
    <Directory Id="blahFolder" Name="blah">
      <Directory Id="INSTALLFOLDER" Name="blah"/>
    </Directory>
  </Directory>
</Directory>

I can get components to reference the INSTALLFOLDER and it will auto-generate GUIDs for them:

<ComponentGroup Id='blahgroup'>
    <Component Id='blahId' Directory='INSTALLFOLDER' Transitive='no'>
      <RegistryKey Root='HKLM' Key='Software\blah\blah' ForceCreateOnInstall='no' ForceDeleteOnUninstall='no'>
        <RegistryValue Type='string' Name='blah' Value='BLAH' />
      </RegistryKey>
    </Component>
    ...
</ComponentGroup>

But in my UI, its nice because I can modify just the installation folder path quite well:

<Product ...>
  ...
  <CustomAction Id='SetInstallFolder' Property='INSTALLFOLDER' Value='[ProgramFilesFolder]blah\blah\'/>
  ...
</Product>

I can then force the INSTALLFOLDER to point anywhere I want:

<InstallUISequence>
  <Custom Action='SetInstallFolder' Sequence='1'/>
  ...
</InstallUISequence>
<AdminUISequence>
  <Custom Action='SetInstallFolder' Sequence='1'/>
  ...
</AdminUISequence>