From 37946a57120645e4385ef0c69a0e3a882b8f7d78 Mon Sep 17 00:00:00 2001 From: "oleg.shilo" Date: Sun, 26 Sep 2021 17:32:50 +1000 Subject: [PATCH] - Fixed problem with `ComponentRef` not being updated when user sets custom `WixEntity.ComponentId` --- Source/src/WixSharp/AutoElements.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/src/WixSharp/AutoElements.cs b/Source/src/WixSharp/AutoElements.cs index 6838cb05..287183ff 100644 --- a/Source/src/WixSharp/AutoElements.cs +++ b/Source/src/WixSharp/AutoElements.cs @@ -501,6 +501,16 @@ static bool DefaultExpandCustomAttribute(XElement source, string item, WixProjec destElement.AddElement(name, null, data); } + else if (key == "Id") + { + var refs = destElement.Document.Root + .FindAll("ComponentRef") + .Where(x => x.HasAttribute("Id", destElement.GetAttribute(key))); + + refs.ForEach(x => x.SetAttribute(key, value)); // reference a new Id + + destElement.SetAttribute(key, value); + } else { destElement.SetAttribute(key, value);