The problem is caused by that silly MSI requirement: "you must define UserProfile registry value if you install in the UserProfile folder". This nonsense is normally handled by Wix# sharp by injecting the dummy registry value for you. But.... not in your case.
Unfortunately "PersonalFolder" was not internally recognized as a UserProfile folder so Wix# failed to help you in this case. Thus I have logged the "Issue#56: %PersonalFileFolders% is not handed as a UserProfile folder" on your behalf. The fix is already committed and it will be in the next release. BUt if you don't want to wait you can download binaries from Git
Alternatively you can fix the problem manually by injecting the required "noise":
Unfortunately "PersonalFolder" was not internally recognized as a UserProfile folder so Wix# failed to help you in this case. Thus I have logged the "Issue#56: %PersonalFileFolders% is not handed as a UserProfile folder" on your behalf. The fix is already committed and it will be in the next release. BUt if you don't want to wait you can download binaries from Git
Alternatively you can fix the problem manually by injecting the required "noise":
[Fact] [Description("Discussions #642263")] publicvoid Should_Inject_RemoveFolder() { var project = new Project("TestProject", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"Files\notepad.exe")), new Dir(@"%CommonAppDataFolder%\Test Project", new File(@"Files\TextFile.txt")), new Dir(@"%PersonalFolder%\Test Project", new File(@"Files\Baskets.bbd"))); project.WixSourceGenerated += Project_WixSourceGenerated; string wxs = project.BuildWxs(); var doc = XDocument.Load(wxs); } void Project_WixSourceGenerated(XDocument document) { var dir = document.FindAll("Directory") .Where(x => x.HasAttribute("Name", "Test Project") && x.Parent.HasAttribute("Name", "PersonalFolder")) .First(); var comp = dir.Element("Component"); comp.AddElement("RemoveFolder", "On=uninstall; Id=" + dir.Attribute("Id").Value); comp.AddElement("RegistryValue", @"Root=HKCU; Key=Software\[Manufacturer]\[ProductName]; Type=string; Value=; KeyPath=yes"); }