diff --git a/NAPS2.Lib/Config/Model/ConfigStorage.cs b/NAPS2.Lib/Config/Model/ConfigStorage.cs index d496701bca..43bbe1b53c 100644 --- a/NAPS2.Lib/Config/Model/ConfigStorage.cs +++ b/NAPS2.Lib/Config/Model/ConfigStorage.cs @@ -241,8 +241,10 @@ public void SerializeTo(XDocument doc, string? customRootElementName) } var serializer = new UntypedXmlSerializer(); var rootElementName = customRootElementName ?? serializer.GetDefaultElementName(typeof(TConfig)); - doc.Add(new XElement(rootElementName)); - CopyNodeToXElement(_root, doc.Root!, serializer); + var root = new XElement(rootElementName); + doc.Add(root); + root.SetAttributeValue(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"); + CopyNodeToXElement(_root, root, serializer); } }