Skip to content

Commit

Permalink
Support deleting orphan products
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbar committed Dec 22, 2022
1 parent e3c6a71 commit 7e33e35
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions MsiZapEx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,16 @@ static void Main(string[] args)
{
List<ProductInfo> orphan = ProductInfo.GetOrphanProducts();
Console.WriteLine($"{orphan.Count} orphan product(s) detected");
foreach (ProductInfo pi in orphan)
using (RegistryModifier modifier = new RegistryModifier())
{
pi.PrintState();
foreach (ProductInfo pi in orphan)
{
pi.PrintState();
if (Settings.Instance.ForceCleanAllRelated)
{
pi.Prune(modifier);
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion MsiZapEx/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Settings
[Option("delete", Required = false, HelpText = "Forcibly remove product's Windows Installer entries from the registry")]
public bool ForceClean { get; set; }

[Option("delete-all-related", Required = false, HelpText = "When used with --upgrade-code or --bundle-upgrade-code, deletes Windows Installer and WiX entries for all related products")]
[Option("delete-all-related", Required = false, HelpText = "When used with --upgrade-code or --bundle-upgrade-code, deletes Windows Installer and WiX entries for all related products. When used with --detect-orphan-products, deletes registration for all orphan products")]
public bool ForceCleanAllRelated { get; set; }

[Option("dry-run", Required = false, HelpText = "Do not delete Windows Installer entries. Instead, print anything that would have been deleted")]
Expand Down
2 changes: 1 addition & 1 deletion TidyBuild.custom.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$(SolutionDir)TidyBuild.user.props" Condition="Exists('$(SolutionDir)TidyBuild.user.props')" />
<PropertyGroup>
<FullVersion Condition="'$(FullVersion)'==''">0.0.9</FullVersion>
<FullVersion Condition="'$(FullVersion)'==''">0.0.10</FullVersion>
<DefineConstants Condition="'$(MSBuildProjectExtension)'=='.wixproj'">FullVersion=$(FullVersion);$(DefineConstants)</DefineConstants>
</PropertyGroup>
</Project>

0 comments on commit 7e33e35

Please sign in to comment.