Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentGroups @Source seems to be ignored #7438

Closed
chrpai opened this issue Apr 24, 2023 · 3 comments
Closed

ComponentGroups @Source seems to be ignored #7438

chrpai opened this issue Apr 24, 2023 · 3 comments
Labels

Comments

@chrpai
Copy link

chrpai commented Apr 24, 2023

  • Which version of WiX are you building with?

4.0.0

  • Which version of Visual Studio are you building with (if any)?

VS2022 Professional 17.5.3

  • Which version of the WiX Toolset Visual Studio Extension are you building with (if any)?

HeatWave 1.0.1.0

  • Describe the problem and the steps to reproduce it.

This Fragment compiles successfully:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <?define SourceDir="..\Deploy"?>
  <Fragment Id="TestAppLib">
    <ComponentGroup Id="TestAppLib">
      <Component Directory="INSTALLLOCATION">
        <File Source="$(var.SourceDir)\TestApp.exe" KeyPath="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

This fragment gives a WIX0103 Cannot find the file 'TestApp.exe'. The following paths were checked: TestApp.exe

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <?define SourceDir="..\Deploy"?>
  <Fragment Id="TestAppLib">
    <ComponentGroup Id="TestAppLib" Source="$(var.SourceDir)">
      <Component Directory="INSTALLLOCATION">
        <File Source="TestApp.exe" KeyPath="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

I also attempted removing the preprocessor variable and just setting ComponentGroup @source to "..\Deploy" but the error message was the same.

  • Describe the behavior you expected and how it differed from the actual behavior.

It's possible I'm using ComponentGroup @source incorrectly but I'm not certain as the doc page has a broken link to specifying source files. (Bug filed). My expectation is that it would combine compine the source from the parent ComponentGroup element and the File element and resolve the path to the file and find it.

@chrpai chrpai added the triage label Apr 24, 2023
@robmen
Copy link
Member

robmen commented Apr 26, 2023

The File element Source attribute overrides the default inherited from the parent elements.

PS: You can get the combined behavior by using the File element Name attribute.

@chrpai
Copy link
Author

chrpai commented Apr 26, 2023

Thanks for the File@Name tip. There's just one more piece that I don't know or doesn't exist in v4.

Consider var.SourceDir = Deploy and Deploy has

File1
SubDir\File2

Component / File Name = File1 grabs Deploy\File1
Component SubDirectory="SubDir" / File Name=File2 trys to grab Deploy\File2 instead of Deploy\SubDir\File2

I'm doing all this as business rules for automation that I'm writing. I'm trying to come up with the most minimalist, expressive easy to read code as possible.

@barnson
Copy link
Member

barnson commented May 2, 2023

@Subdirectory is for target path and doesn't enter into source logic. Directory/@FileSource is a thing but doesn't have a parallel if you're not creating child Directorys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants