s.matushonok
s.matushonok

Reputation: 7585

Wix# Empty Directories sample does not work?

What I'm trying to do is to create an empty folder using wix# installer.

I've found the "Empty Directories" sample ( "src/WixSharp.Samples/Wix# Samples/Empty Directories" ) which says that:

When working with raw Wix you cannot have empty directories. Every directory must have either component (e.g. File) or special element CreateFolder.

Wix# does not have such limitation as it simply creates all necessary syntactical decoration (injects CreateFolder element) in Wix source file automatically when empty directory declaration is detected.

But when I build and run the sample I didn't get any "Samples" or "Docs" folders ( empty folders from the sample ).

The log file contains the following:

Action 16:25:24: RemoveFiles. Removing files
Action start 16:25:24: RemoveFiles.
RemoveFiles: File: Removing files, Directory: 
MSI (s) (7C:F4) [16:25:24:926]: Counted 2 foreign folders to be removed.
MSI (s) (7C:F4) [16:25:24:926]: Removing foreign folder: C:\Program Files (x86)\My Company\My Product\Docs\Manual\
MSI (s) (7C:F4) [16:25:24:926]: Removing foreign folder: C:\Program Files (x86)\My Company\My Product\Samples\
Action ended 16:25:24: RemoveFiles. Return value 1.

What does "foreign" means? What am I doing wrong?

WiX Toolset v3.10.1 is used.

Upvotes: 1

Views: 1177

Answers (1)

mbinic
mbinic

Reputation: 31

You are not doing anything wrong, the issue was in WixSharp and has been fixed in version 1.0.32.1.

For the long answer you can look at the issue on the WixSharp CodePlex page, but the short one would be (paraphrasing WixSharp author, Oleg):

MSI doesn't 'really' support installing empty folders. The workaround is to insert an empty component with a CreateFolder element. But then, to remove the folder on uninstall, we need to insert a RemoveFolder element into the empty component as well. We also need to take into account parent folders of the empty folder and apply that recursively to all of them. These workarounds are holding with no undesirable effects, for now.

Wix# was adding these workarounds and eventually they started conflicting with each other, which resulted in the "EmptyDirectories" sample and functionality being broken.

Upvotes: 0

Related Questions