diff --git a/ReleaseBuilder/Build/Command.Compile.Post.cs b/ReleaseBuilder/Build/Command.Compile.Post.cs
index ab446c704..0b269bac6 100644
--- a/ReleaseBuilder/Build/Command.Compile.Post.cs
+++ b/ReleaseBuilder/Build/Command.Compile.Post.cs
@@ -1,7 +1,4 @@
-using System.IO.Compression;
-using System.Net;
using System.Text.RegularExpressions;
-using Duplicati.Library.Utility;
namespace ReleaseBuilder.Build;
diff --git a/ReleaseBuilder/Build/Command.CreatePackage.cs b/ReleaseBuilder/Build/Command.CreatePackage.cs
index 5089a2770..608736ecf 100644
--- a/ReleaseBuilder/Build/Command.CreatePackage.cs
+++ b/ReleaseBuilder/Build/Command.CreatePackage.cs
@@ -258,7 +258,7 @@ public static partial class Command
if (File.Exists(binFiles))
File.Delete(binFiles);
- File.WriteAllText(binFiles, WixHeatBuilder.CreateWixFilelist(sourceFiles));
+ File.WriteAllText(binFiles, WixHeatBuilder.CreateWixFilelist(sourceFiles, version: rtcfg.ReleaseInfo.Version.ToString()));
var msiArch = target.Arch switch
{
diff --git a/ReleaseBuilder/Resources/Windows/Duplicati.wxs b/ReleaseBuilder/Resources/Windows/Duplicati.wxs
index 2995fcdd6..1e6a9623e 100644
--- a/ReleaseBuilder/Resources/Windows/Duplicati.wxs
+++ b/ReleaseBuilder/Resources/Windows/Duplicati.wxs
@@ -44,19 +44,19 @@
-
+ FORSERVICE = "true"
-
+ FORSERVICE = "true"
@@ -68,14 +68,9 @@
-
-
-
-
-
-
-
-
+
diff --git a/ReleaseBuilder/WixHeatBuilder.cs b/ReleaseBuilder/WixHeatBuilder.cs
index 2a27fe091..b5404ffc3 100644
--- a/ReleaseBuilder/WixHeatBuilder.cs
+++ b/ReleaseBuilder/WixHeatBuilder.cs
@@ -15,7 +15,7 @@ public static class WixHeatBuilder
/// The name of the component group
/// A function to generate file IDs.
/// The wix file xml contents
- public static string CreateWixFilelist(string sourceFolder, string folderPrefix = "$(var.HarvestPath)", string directoryRefName = "INSTALLLOCATION", string componentGroupId = "DUPLICATIBIN", Func? fileIdGenerator = null)
+ public static string CreateWixFilelist(string sourceFolder, string version, string folderPrefix = "$(var.HarvestPath)", string directoryRefName = "INSTALLLOCATION", string componentGroupId = "DUPLICATIBIN", Func? fileIdGenerator = null)
{
var itemIds = new Dictionary();
fileIdGenerator ??= (x) => Path.GetRelativePath(sourceFolder, x).Replace("\\", "_").Replace("/", "_").Replace(":", "_").Replace(" ", "_");
@@ -32,9 +32,9 @@ public static class WixHeatBuilder
foreach (var f in Directory.EnumerateFileSystemEntries(sourceFolder))
if (File.Exists(f))
- AddFile(doc, directoryRef, f, itemIds, fileIdGenerator, pathTransformer);
+ AddFile(doc, directoryRef, f, version, itemIds, fileIdGenerator, pathTransformer);
else if (Directory.Exists(f))
- AddDirectory(doc, directoryRef, f, itemIds, fileIdGenerator, pathTransformer);
+ AddDirectory(doc, directoryRef, f, version, itemIds, fileIdGenerator, pathTransformer);
var fragment2 = doc.CreateElement("Fragment");
root.AppendChild(fragment2);
@@ -59,9 +59,10 @@ public static class WixHeatBuilder
/// The XML document.
/// The XML element representing the directory reference.
/// The file to be added.
+ /// The version of the file.
/// The dictionary containing the item IDs.
/// The function to generate file IDs.
- private static void AddFile(XmlDocument doc, XmlElement directoryRef, string file, Dictionary itemIds, Func fileIdGenerator, Func pathTransformer)
+ private static void AddFile(XmlDocument doc, XmlElement directoryRef, string file, string version, Dictionary itemIds, Func fileIdGenerator, Func pathTransformer)
{
var id = fileIdGenerator.Invoke(file);
itemIds.Add(file, id);
@@ -74,6 +75,7 @@ public static class WixHeatBuilder
var fileElement = doc.CreateElement("File");
fileElement.SetAttribute("Id", id);
fileElement.SetAttribute("KeyPath", "yes");
+ fileElement.SetAttribute("DefaultVersion", version);
fileElement.SetAttribute("Source", pathTransformer(file));
component.AppendChild(fileElement);
}
@@ -84,9 +86,10 @@ public static class WixHeatBuilder
/// The XML document to add the directory to.
/// The parent directory reference element.
/// The directory path to add.
+ /// The version of the directory.
/// A dictionary to store the mapping between directory paths and their generated IDs.
/// A function to generate file IDs.
- private static void AddDirectory(XmlDocument doc, XmlElement directoryRef, string dir, Dictionary itemIds, Func fileIdGenerator, Func pathTransformer)
+ private static void AddDirectory(XmlDocument doc, XmlElement directoryRef, string dir, string version, Dictionary itemIds, Func fileIdGenerator, Func pathTransformer)
{
var id = fileIdGenerator.Invoke(dir);
@@ -97,9 +100,9 @@ public static class WixHeatBuilder
directoryRef.AppendChild(directory);
foreach (var file in Directory.GetFiles(dir))
- AddFile(doc, directory, file, itemIds, fileIdGenerator, pathTransformer);
+ AddFile(doc, directory, file, version, itemIds, fileIdGenerator, pathTransformer);
foreach (var subDir in Directory.GetDirectories(dir))
- AddDirectory(doc, directory, subDir, itemIds, fileIdGenerator, pathTransformer);
+ AddDirectory(doc, directory, subDir, version, itemIds, fileIdGenerator, pathTransformer);
}
}
\ No newline at end of file