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

"Complete" feature gets added automatically & after installation of MSI, an empty feature folder installed even if it is not selected #1578

Closed
abskulkarni opened this issue Jul 7, 2024 · 16 comments

Comments

@abskulkarni
Copy link

Hi @oleg-shilo
I am attaching my Wix Project (InsuranceDataRepository.zip) & source directory for it (PROPHET_IDR_Build.zip) here.

I am facing two problems:

  1. One feature named "Complete" gets added in Feature list of Feature free when MSI is run.
  2. If I install MSI, it installs empty "IDRDatabaseScripts" folder (which is a feature) even if it is not selected.

Can you please guide me is in finding root cause & resolving these problems?

PROPHET_IDR_Build.zip
InsuranceDataRepository.zip

@abskulkarni abskulkarni changed the title "Complete" feature gets added automatically & after installation of MSI, an empty feature created even if it is not selected "Complete" feature gets added automatically & after installation of MSI, an empty feature folder installed even if it is not selected Jul 7, 2024
@oleg-shilo
Copy link
Owner

If you do not specify Feature then a default feature is created for automatically. It will be named Complete:
image

The intended scenario is that you have a set of files to install and all of them belong to a feature (yours or a default one). Any other files are grouped in other features.

If I install MSI, it installs empty "IDRDatabaseScripts" folder (which is a feature) even if it is not selected.

Sorry, debugging your production solution is not really a support option. If you share something you want me to run/debug it needs to be simplified and sanitized to the level of hello-world project. I hope you understand where I am coming from.

@oleg-shilo
Copy link
Owner

Have a look at this sample
image

@abskulkarni
Copy link
Author

If you do not specify Feature then a default feature is created for automatically. It will be named Complete: image

The intended scenario is that you have a set of files to install and all of them belong to a feature (yours or a default one). Any other files are grouped in other features.

If I install MSI, it installs empty "IDRDatabaseScripts" folder (which is a feature) even if it is not selected.

Sorry, debugging your production solution is not really a support option. If you share something you want me to run/debug it needs to be simplified and sanitized to the level of hello-world project. I hope you understand where I am coming from.

Hi @oleg-shilo
thanks for your reply. I will try out "complete" feature related suggestion.
For other issue, I have not given full production setup. Source files are having simple empty test.txt files. I gave it as I am unable to locate this bug of extra specific empty folder. Hope you will help in resolving this.

@oleg-shilo
Copy link
Owner

Sorry @abskulkarni,
Without a simple hello-world style test case that can only provid with you generic guidance. Without readable test case I am blind.

Another suggestion, try set AutoElements.SupportEmptyDirectories = CompilerSupportState.Disabled;. It might be what you need.

@abskulkarni
Copy link
Author

No problem @oleg-shilo
I figured it out myself. I was taking specific extension files from base directory of feature where those files with extensions were not present. (actual extension files are present in sub folders) So that feature was getting created as empty one. So its base folder was installed even if it has no files.

I don't know how successful I am in explaining my root cause but it is working now.

@oleg-shilo
Copy link
Owner

Actually, you are successful. :)
BTW, MSI/WiX out of the box does not install empty folders. WixSharp facilitates it via SupportEmptyDirectories. It was a feature implemented upon user request.
I am glad you figured it out.

@abskulkarni
Copy link
Author

abskulkarni commented Jul 9, 2024

Hi @oleg-shilo
What is SupportEmptyDirectories ? Is it project property?
So if my feature is an empty directory & if I set SupportEmptyDirectories to false, that feature will be ignored in feature list and not installed?

Lastly, since I know now root cause of my issue, how can I include sub folders in my new Files constructor or somewhere in Files object?

Like below, I want sub-folders of sourceDir also to be looked up for searching file extensions. How to do that?

image

@oleg-shilo
Copy link
Owner

oleg-shilo commented Jul 10, 2024

This is the statement that configures WixSharp engine to fake empty directories so MSI is happy.
In fact, there are two settings for that: one (AutoElements) is for controlling auto-generation of non-XML related algorithms. IE Id allocation.
And also there is another one that controls various aspects of XML generation (Compiler.AutoGeneration).
I suggest you experiment with both of them:

AutoElements.SupportEmptyDirectories = CompilerSupportState.Disabled;
Compiler.AutoGeneration.IgnoreWildCardEmptyDirectories = true;

I am not happy with the inline documentation for these classes so I will update it to make it clear which aspect of autogeneration each class controls.

oleg-shilo added a commit that referenced this issue Jul 10, 2024
@oleg-shilo
Copy link
Owner

I have updated the documentation. And will schedule the partial merger of AutoElements and Compiler.AutoGeneration

@oleg-shilo
Copy link
Owner

since I know now root cause of my issue, how can I include sub folders in my new Files constructor or somewhere in Files

Not sure I know what you mean, but Files will automatically pick all subfolders found.
However if you are asking about new Files( new Dir(... then no. new Dir can only be inside of te parent dir. Exactly as in the file system.

@smaudet
Copy link

smaudet commented Jul 10, 2024

In addition, the examples project is wrong/misleading.

If you try to create a project with 2.1.2/2.1.7 (haven't checked 2.2.1 yet) at least, with only features, and a "default feature" which adds all those, the installer is unusable (crashes).

oleg-shilo added a commit that referenced this issue Jul 13, 2024
- #1580 Shortcut "Target" produces unexpected results for many supported WiX environment constants
- #1574: Cannot build .net 8 example project (NET-Core)
- #1546: dotnet tool install --global wix - Need for all users
- #1585:  Dotnet tool should not be relied on for wixsharp.   Added error logging on `dotnet` or `wix` not found.
- Added error log for failure to find WiX extension. Triggered by #1574, #1589
- Improved the documentation for `AutoElements` and `Compiler.AutoGeneration` (triggered by #1578)
- #7591: added WiX5 Custom BA sample (`<wixsharp>\Source\src\WixSharp.Samples\Wix# Samples\Bootstrapper\WiX5-Spike\WixToolset.WixBA`)
- added missing SilentBA for `WixSharp.Core`
- fixed problem with `SetShellSize` not setting the top level window size
@oleg-shilo
Copy link
Owner

oleg-shilo commented Jul 13, 2024

In addition, the examples project...

@smaudet, I assume you are referring to <wixsharp>\Source\src\WixSharp.Samples\Wix# Samples\Features\setup.cs. Is it right?
If it is, then... this sample works OK. I just tested.
So can you elaborate on which sample crashes?

@smaudet
Copy link

smaudet commented Jul 19, 2024

@oleg-shilo No:

Source/src/WixSharp.Samples/Wix# Samples/MergeModules/Consuming MergeModule/setup.cs

A) there is what I presume to be a typo and featureB is included twice (instead of A and B) on lines 30,31.
B) when I was attempting to replicate this setup myself the msi would crash on startup. I had issues debugging and did not investigate further - I did note the "complete" feature didn't do anything useful and actually appeared to be the cause of the crash (somehow). It also shows up without being added explicitly.

@oleg-shilo
Copy link
Owner

Interesting.
The featureB is indeed included twice but on purpose. The idea was that two msm modules belong to the same feature. Though the featureA (with a text file deployment) line was commented out by accident. I have fixed it now:

var project =
        new Project("MyMergeModuleSetup",
            new MediaTemplate { CompressionLevel = CompressionLevel.none, EmbedCab = false },
            new Dir(@"%ProgramFiles%\My Company",
                new File(featureA, @"Files\MainFile.txt"), // was commented out
                new Merge(featureB, @"Files\MyMergeModule.msm"),
                new Merge(featureB, @"Files\MyMergeModule1.msm")),
            new EnvironmentVariable("foo", "bar"));

Having featureA commented out does not make the difference failure-wise, but you are right, without featureA the whole features split did not make sense. So it's fixed and the sample is already in the repo.

Now, about the crash.
It's strange, but the example is finishing OK for me:
image

MSM modules are sensitive to MSI Installer version. Is it possible that your target system somehow is incompatible? It's a wild guess. The log may give some idea. Can you collect the log file for that and share it?

And I tested the booth builds with and without featureA being commented out.

@smaudet
Copy link

smaudet commented Sep 11, 2024

@oleg-shilo I think I found the cause of my issue - the custom WPF UI template you include has several issues (lots of unsafe code), specifically the Nodes on Node are left null, which causes a problem when you attempt to load them...

I will create a new ticket in a minute, trying to fix my merge + node tree now...

EDIT:

I have enumerated some of the issues here: #1637

@oleg-shilo
Copy link
Owner

yep, I have left the comment there for you. I think you might be missing the SHA-1: 96ff602 fix. But other problems may still be there. Will see...

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

No branches or pull requests

3 participants