Skip to content

Commit

Permalink
- - WiX4: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-shilo committed Apr 8, 2023
1 parent c9d214e commit 9fa5281
Show file tree
Hide file tree
Showing 20 changed files with 174 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ static public void Main()

project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");

project.UI = WUI.WixUI_InstallDir;

project.EmitConsistentPackageId = true;
project.PreserveTempFiles = true;
project.PreserveDbgFiles = true;
Expand Down
8 changes: 8 additions & 0 deletions Source/src/WixSharp/Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ THE SOFTWARE.

#endregion Licence...

using System.Xml.Linq;

namespace WixSharp
{
/// <summary>
Expand Down Expand Up @@ -174,6 +176,12 @@ public Action(Id id, Return returnType, When when, Step step, Condition conditio
/// </summary>
public Condition Condition = Condition.NOT_Installed;

#if WIX3
internal object ToXmlCondition() => this.Condition.ToXValue();
#else
internal XAttribute ToXmlCondition() => new XAttribute("Condition", this.Condition.ToString());
#endif

/// <summary>
/// The sequence number for this action. Mutually exclusive with Before, After, and OnExit of <see cref="When"/> field.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
using System.IO;
using System.Linq;
using System.Xml.Linq;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

using sys = System.IO;

Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/CommonTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ THE SOFTWARE.
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.XPath;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp;
using WixSharp.Bootstrapper;
using WixSharp.Controls;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif
using IO = System.IO;

namespace WixSharp.CommonTasks
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/Compiler.Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ THE SOFTWARE.
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.Bootstrapper;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif
using IO = System.IO;

namespace WixSharp
Expand Down
118 changes: 74 additions & 44 deletions Source/src/WixSharp/Compiler.cs

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions Source/src/WixSharp/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
using Microsoft.Win32;
using WixSharp.CommonTasks;
using static WixSharp.SetupEventArgs;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

using IO = System.IO;

Expand Down Expand Up @@ -2806,7 +2810,7 @@ public static bool IsCancelled(this Session session)
{
try
{
session.Message(Microsoft.Deployment.WindowsInstaller.InstallMessage.ActionData, new Record());
session.Message(WixToolset.Dtf.WindowsInstaller.InstallMessage.ActionData, new Record());
}
catch (InstallCanceledException)
{
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/InternetShortcut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
using System.Security.Principal;
using System.Text;
using System.Xml.Linq;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using System.Globalization;
using System.Reflection;
using System.Text.RegularExpressions;
using static WixSharp.SetupEventArgs;
using WixSharp.CommonTasks;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp
{
Expand Down
4 changes: 4 additions & 0 deletions Source/src/WixSharp/ManagedAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ THE SOFTWARE.
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp
{
Expand Down
4 changes: 4 additions & 0 deletions Source/src/WixSharp/ManagedProject/Interfaces.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif
using Reflection = System.Reflection;

#pragma warning disable 1591
Expand Down
7 changes: 6 additions & 1 deletion Source/src/WixSharp/ManagedProject/ManagedProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.CommonTasks;

#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

using IO = System.IO;

namespace WixSharp
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/ManagedProject/ManagedProjectActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.CommonTasks;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp
{
Expand Down
7 changes: 6 additions & 1 deletion Source/src/WixSharp/ManagedProject/SetupEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.CommonTasks;

#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp
{
/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/NativeImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
using System.Security.Principal;
using System.Text;
using System.Xml.Linq;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using System.Globalization;
using System.Reflection;
using System.Text.RegularExpressions;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif
using static WixSharp.SetupEventArgs;

namespace WixSharp
Expand Down
7 changes: 5 additions & 2 deletions Source/src/WixSharp/ProjectValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ THE SOFTWARE.
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.CommonTasks;

#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif
using IO = System.IO;
using Reflection = System.Reflection;

Expand Down
12 changes: 9 additions & 3 deletions Source/src/WixSharp/ResilientPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using WixSharp.CommonTasks;
using WixSharp.Utilities;

#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

using IO = System.IO;

namespace WixSharp
Expand Down Expand Up @@ -65,7 +71,7 @@ public static void EnableResilientPackage(this Project project, string resilient
Return.check,
When.Before, Step.PublishProduct,
Condition.NOT_Installed)
);
);

var assembly = typeof(ResilientPackage).Assembly.Location;

Expand Down Expand Up @@ -93,7 +99,7 @@ public static void EnableResilientPackage(this Project project, string resilient
{
UsesProperties = $"UserSID,OriginalDatabase,ALLUSERS,{WIXSHARP_RESILIENT_SOURCE_DIR}"
}
);
);
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/UACRevealer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.XPath;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using WixSharp;
using WixSharp.Controls;
#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp.CommonTasks
{
Expand Down
9 changes: 7 additions & 2 deletions Source/src/WixSharp/UninstallFullUI.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using System.Linq;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using WixSharp.CommonTasks;

#if WIX3
using Microsoft.Deployment.WindowsInstaller;
#else
using WixToolset.Dtf.WindowsInstaller;
#endif

namespace WixSharp
{
/// <summary>
Expand Down Expand Up @@ -79,7 +84,7 @@ public static void EnableUninstallFullUI(this Project project, string displayIco
{
return;
}

var comp = doc.FindAll("RegistryValue")
.First(x => x.HasAttribute("Id", "WixSharp_RegValue_DisplayIcon"))
.Parent
Expand Down
4 changes: 4 additions & 0 deletions Source/src/WixSharp/WixExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ public static string GetNamespaceDeclaration(string prefix, string @namespace)
/// <summary>
/// Well-known Wix Extension UI
/// </summary>
#if WIX3
public static WixExtension UI = new WixExtension("%WixLocation%\\WixUIExtension.dll", null, null);
#else
public static WixExtension UI = new WixExtension(@"C:\Users\oleg.shilo\.nuget\packages\wixtoolset.ui.wixext\4.0.0\wixext4\WixToolset.UI.wixext.dll", null, null);
#endif
}

/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions Source/src/WixSharp/WixSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@
<Name>WixSharp.Msi</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Dtf.WindowsInstaller">
<Version>4.0.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit 9fa5281

Please sign in to comment.