diff --git a/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/CustomAction.dll b/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/CustomAction.dll index 1ccf4c10..c0ad6483 100644 Binary files a/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/CustomAction.dll and b/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/CustomAction.dll differ diff --git a/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/DispalyMessage.dll b/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/DispalyMessage.dll index 8b0b12cd..64f9c068 100644 Binary files a/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/DispalyMessage.dll and b/Source/src/WixSharp.Samples/Wix# Samples/DTF (ManagedCA)/Different Scenarios/ExternalAssembly/DispalyMessage.dll differ diff --git a/Source/src/WixSharp.Samples/Wix# Samples/Extensions/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/Extensions/setup.cs index f2b2a3df..12c5e489 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/Extensions/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/Extensions/setup.cs @@ -36,6 +36,7 @@ /// /// /// + class Script { static public void Main() @@ -144,7 +145,7 @@ public void PseudoProcessWithNewComponentAndFeature(ProcessingContext context) .Add(element); context.XParent - .Parent(Compiler.ProductElementName) + .Parent("Product") .AddElement("Feature", "Id=TestFeature;Title=Test Feature;Absent=allow;Level=1") .AddElement("ComponentRef", "Id=TestComponent"); } diff --git a/Source/src/WixSharp.Samples/Wix# Samples/External_UI/Msi/MyProduct.msi b/Source/src/WixSharp.Samples/Wix# Samples/External_UI/Msi/MyProduct.msi index a27d7b94..91eda471 100644 Binary files a/Source/src/WixSharp.Samples/Wix# Samples/External_UI/Msi/MyProduct.msi and b/Source/src/WixSharp.Samples/Wix# Samples/External_UI/Msi/MyProduct.msi differ diff --git a/Source/src/WixSharp.Samples/Wix# Samples/IIS/XMLInjection/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/IIS/XMLInjection/setup.cs index b262e171..395893a3 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/IIS/XMLInjection/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/IIS/XMLInjection/setup.cs @@ -2,9 +2,9 @@ //css_ref ..\..\..\Wix_bin\SDK\Microsoft.Deployment.WindowsInstaller.dll; //css_ref System.Core.dll; using System; -using System.Linq; using System.Xml; using System.Xml.Linq; +using System.Linq; using WixSharp; using WixSharp.CommonTasks; @@ -13,13 +13,13 @@ class Script static public void Main() { var project = - new Project("My Product", - new Dir(@"%ProgramFiles%\MyCompany", - new Dir(@"MyWebApp", - new File(@"MyWebApp\Default.aspx"), - new File(@"MyWebApp\Default.aspx.cs"), - new File(@"MyWebApp\Default.aspx.designer.cs"), - new File(@"MyWebApp\Web.config")))); + new Project("My Product", + new Dir(@"%ProgramFiles%\MyCompany", + new Dir(@"MyWebApp", + new File(@"MyWebApp\Default.aspx"), + new File(@"MyWebApp\Default.aspx.cs"), + new File(@"MyWebApp\Default.aspx.designer.cs"), + new File(@"MyWebApp\Web.config")))); project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b"); @@ -36,8 +36,8 @@ static void Compiler_WixSourceGenerated(System.Xml.Linq.XDocument document) XElement aspxFileComponent = (from e in document.FindAll("File") where e.Attribute("Source").Value.EndsWith("Default.aspx") select e) - .First() - .Parent; + .First() + .Parent; string dirID = aspxFileComponent.Parent.Attribute("Id").Value; @@ -52,13 +52,13 @@ where e.Attribute("Source").Value.EndsWith("Default.aspx") new XAttribute("Id", "TestWebApplication"), new XAttribute("Name", "Test")))); - document.Root.Select(Compiler.ProductElementName) + document.Root.Select("Product") .Add(new XElement(ns + "WebSite", new XAttribute("Id", "DefaultWebSite"), new XAttribute("Description", "Default Web Site"), new XAttribute("Directory", dirID), new XElement(ns + "WebAddress", - new XAttribute("Id", "AllUnassigned"), - new XAttribute("Port", "80")))); + new XAttribute("Id", "AllUnassigned"), + new XAttribute("Port", "80")))); } } \ No newline at end of file diff --git a/Source/src/WixSharp.Samples/Wix# Samples/InjectXML/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/InjectXML/setup.cs index 2597a401..5de7190c 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/InjectXML/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/InjectXML/setup.cs @@ -77,7 +77,7 @@ static public void Main() private static void InjectImages(System.Xml.Linq.XDocument document) { - var productElement = document.Root.Select(Compiler.ProductElementName); + var productElement = document.Root.Select("Product"); productElement.Add(new XElement("WixVariable", new XAttribute("Id", "WixUIBannerBmp"), diff --git a/Source/src/WixSharp.Samples/Wix# Samples/Install Files/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/Install Files/setup.cs index 13b5b9fa..648a0a8e 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/Install Files/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/Install Files/setup.cs @@ -15,9 +15,6 @@ class Script { static public void Main() { - Compiler.WixLocation = @"C:\Users\oleg.shilo\.dotnet\tools\.store\wix\4.0.0\wix\4.0.0\tools\net6.0\any"; - Compiler.IsWix4 = true; - File f; var project = new Project("MyProduct", @@ -43,8 +40,6 @@ 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; @@ -58,7 +53,7 @@ static public void Main() project.WixSourceGenerated += Compiler_WixSourceGenerated; - project.BuildMsiCmd(); + project.BuildMsi(); } private static void Compiler_WixSourceGenerated(XDocument document) diff --git a/Source/src/WixSharp.Samples/Wix# Samples/Managed Setup/Self-executable_Msi/ManagedSetup.msi b/Source/src/WixSharp.Samples/Wix# Samples/Managed Setup/Self-executable_Msi/ManagedSetup.msi deleted file mode 100644 index e6e56ba7..00000000 Binary files a/Source/src/WixSharp.Samples/Wix# Samples/Managed Setup/Self-executable_Msi/ManagedSetup.msi and /dev/null differ diff --git a/Source/src/WixSharp.Samples/Wix# Samples/MultipleInstances Install/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/MultipleInstances Install/setup.cs index 243ecbb1..32dfb1fb 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/MultipleInstances Install/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/MultipleInstances Install/setup.cs @@ -4,12 +4,12 @@ using System; using System.IO; -using System.Linq; using System.Xml; using System.Xml.Linq; -using Microsoft.Deployment.WindowsInstaller; +using System.Linq; using WixSharp; using File = WixSharp.File; +using Microsoft.Deployment.WindowsInstaller; public class Script { @@ -44,7 +44,7 @@ static public void Main() new XAttribute("ProductCode", Guid.NewGuid()), new XAttribute("ProductName", "My Product " + instance))); - document.Root.Select(Compiler.ProductElementName).Add(instanceTransforms); + document.Root.Select("Product").Add(instanceTransforms); }; Compiler.BuildMsi(project); diff --git a/Source/src/WixSharp.Samples/Wix# Samples/Skip_UIDialog/setup.cs b/Source/src/WixSharp.Samples/Wix# Samples/Skip_UIDialog/setup.cs index 5fa16f7d..0609a1d8 100644 --- a/Source/src/WixSharp.Samples/Wix# Samples/Skip_UIDialog/setup.cs +++ b/Source/src/WixSharp.Samples/Wix# Samples/Skip_UIDialog/setup.cs @@ -33,9 +33,9 @@ static public void Main() static void Compiler_WixSourceGenerated(XDocument document) { - document.Root.Select(Compiler.ProductElementName) + document.Root.Select("Product") .Add(XElement.Parse( - @" + @" 1 1 ")); diff --git a/Source/src/WixSharp.Test/IssueFixesTest.cs b/Source/src/WixSharp.Test/IssueFixesTest.cs index 572b16b6..4281bd17 100644 --- a/Source/src/WixSharp.Test/IssueFixesTest.cs +++ b/Source/src/WixSharp.Test/IssueFixesTest.cs @@ -434,9 +434,9 @@ public void Should_Handle_EmptyFeatures() var doc = XDocument.Load(wsxfile); - var product = doc.FindSingle(Compiler.ProductElementName); + var product = doc.FindSingle("Product"); - var rootFeature = doc.Select($"Wix/{Compiler.ProductElementName}/Feature"); + var rootFeature = doc.Select("Wix/Product/Feature"); Assert.NotNull(rootFeature); var docsFeature = rootFeature.Elements() diff --git a/Source/src/WixSharp/Action.cs b/Source/src/WixSharp/Action.cs index 6d293fad..d24069f6 100644 --- a/Source/src/WixSharp/Action.cs +++ b/Source/src/WixSharp/Action.cs @@ -27,8 +27,6 @@ THE SOFTWARE. #endregion Licence... -using System.Xml.Linq; - namespace WixSharp { /// @@ -176,12 +174,6 @@ public Action(Id id, Return returnType, When when, Step step, Condition conditio /// 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 - /// /// The sequence number for this action. Mutually exclusive with Before, After, and OnExit of field. /// diff --git a/Source/src/WixSharp/AutoElements.cs b/Source/src/WixSharp/AutoElements.cs index 52e4c068..ad94f3dc 100644 --- a/Source/src/WixSharp/AutoElements.cs +++ b/Source/src/WixSharp/AutoElements.cs @@ -415,7 +415,7 @@ select s.Attribute("Icon").Value).Distinct()) shortcut.Attribute("Icon").Value = iconId; } - XElement product = doc.Root.Select(Compiler.ProductElementName); + XElement product = doc.Root.Select("Product"); foreach (string file in icons.Keys) product.AddElement( @@ -426,7 +426,7 @@ select s.Attribute("Icon").Value).Distinct()) static void InjectPlatformAttributes(XDocument doc) { - var is64BitPlatform = doc.Root.Select(Compiler.IsWix4 ? "Package" : "Product/Package").HasAttribute("Platform", val => val == "x64"); + var is64BitPlatform = doc.Root.Select("Product/Package").HasAttribute("Platform", val => val == "x64"); if (is64BitPlatform) { @@ -599,7 +599,7 @@ static void InsertEmptyComponentsInParentDirectories(XDocument doc, XElement ite static void CreateEmptyComponentsInDirectoriesToRemove(XDocument doc) { - XElement product = doc.Root.Select(Compiler.ProductElementName); + XElement product = doc.Root.Select("Product"); // Create new empty components in parent directories of components with no files or registry var dirsWithNoFilesOrRegistryComponents = product.Descendants("Directory") @@ -615,7 +615,7 @@ static void CreateEmptyComponentsInDirectoriesToRemove(XDocument doc) internal static void HandleEmptyDirectories(XDocument doc) { - XElement product = doc.Root.Select(Compiler.ProductElementName); + XElement product = doc.Root.Select("Product"); var dummyDirs = product.Descendants("Directory") .SelectMany(x => x.Elements("Component")) @@ -683,7 +683,7 @@ internal static void InjectAutoElementsHandler(XDocument doc, Project project) InjectShortcutIcons(doc); HandleEmptyDirectories(doc); - XElement product = doc.Root.Select(Compiler.ProductElementName); + XElement product = doc.Root.Select("Product"); int? absPathCount = null; foreach (XElement dir in product.Element("Directory").Elements("Directory")) diff --git a/Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs b/Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs index bd617e85..d010efb3 100644 --- a/Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs +++ b/Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs @@ -3,11 +3,7 @@ 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; diff --git a/Source/src/WixSharp/ComRegistration.cs b/Source/src/WixSharp/ComRegistration.cs index fa3de6bf..0f55f236 100644 --- a/Source/src/WixSharp/ComRegistration.cs +++ b/Source/src/WixSharp/ComRegistration.cs @@ -114,7 +114,7 @@ public AppId() /// public void Process(ProcessingContext context) { - string[] AdvertiseParents = { "Fragment", "Module", Compiler.ProductElementName }; + string[] AdvertiseParents = { "Fragment", "Module", "Product" }; // If the parent element is a Fragment, Module, or Product, ensure Advertised is true. if (!Advertise && AdvertiseParents.Any(s => s == context.XParent.Name.LocalName)) diff --git a/Source/src/WixSharp/CommonTasks.cs b/Source/src/WixSharp/CommonTasks.cs index e8c7cd9a..d1762aa3 100644 --- a/Source/src/WixSharp/CommonTasks.cs +++ b/Source/src/WixSharp/CommonTasks.cs @@ -32,14 +32,10 @@ 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 @@ -772,7 +768,7 @@ static public File AddAssociations(this File file, params FileAssociation[] item // progId.SetAttribute("Icon", iconId); - // doc.FindSingle(Compiler.ProductElementName) + // doc.FindSingle("Product") // .AddElement("Icon", $@"Id={iconId};SourceFile={iconPath}"); // }; // } @@ -1059,7 +1055,7 @@ static public Project SetVersionFrom(this Project project, string fileId, bool s { project.SetVersionFromIdValue = fileId; project.WixSourceGenerated += document => - document.FindSingle(Compiler.ProductElementName) + document.FindSingle("Product") .AddAttributes("Version=!(bind.FileVersion." + fileId + ")"); if (setProjectVersionAsWell) diff --git a/Source/src/WixSharp/Compiler.Bootstrapper.cs b/Source/src/WixSharp/Compiler.Bootstrapper.cs index 7ff31edc..6eec53eb 100644 --- a/Source/src/WixSharp/Compiler.Bootstrapper.cs +++ b/Source/src/WixSharp/Compiler.Bootstrapper.cs @@ -37,12 +37,8 @@ THE SOFTWARE. using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml.Linq; -using WixSharp.Bootstrapper; -#if WIX3 using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif +using WixSharp.Bootstrapper; using IO = System.IO; namespace WixSharp diff --git a/Source/src/WixSharp/Compiler.cs b/Source/src/WixSharp/Compiler.cs index 6d46cd80..6ed4120d 100644 --- a/Source/src/WixSharp/Compiler.cs +++ b/Source/src/WixSharp/Compiler.cs @@ -27,37 +27,19 @@ THE SOFTWARE. #endregion Licence... +using Microsoft.Deployment.WindowsInstaller; using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Xml.Linq; using WixSharp.CommonTasks; -#if WIX3 -using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif using IO = System.IO; -/* - Wix4 challenges - -- No samples -- No API porting documentation (only for v3 vs v4 CLI). It's not clear how to port no longer existing attributes (e.g. Package.Languages) -- How v3 WiX extensions are mapped to the nuget packages for v4 - - - - - */ - - namespace WixSharp { @@ -307,11 +289,6 @@ public partial class Compiler /// static public string CandleOptions = "-sw1026 "; - /// - /// WiX compiler wix.exe options (e.g. "-define DEBUG"). Available only in WiX v4.* - /// - public static string WixOptions = ""; - static string autogeneratedWxsForVS = null; static Compiler() @@ -594,39 +571,13 @@ static void BuildCmd(Project project, string path, OutputType type) string wixLocationEnvVar = $"set WixLocation={WixLocation}"; string compiler = Utils.PathCombine(WixLocation, "candle.exe"); - string wix = Utils.PathCombine(WixLocation, "wix.exe"); string linker = Utils.PathCombine(WixLocation, "light.exe"); string batchFile = path; - if ((Compiler.IsWix4 && !IO.File.Exists(wix)) || - (!Compiler.IsWix4 && (!IO.File.Exists(compiler) || !IO.File.Exists(linker)))) + if (!IO.File.Exists(compiler) && !IO.File.Exists(linker)) { Compiler.OutputWriteLine("Wix binaries cannot be found. Expected location is " + IO.Path.GetDirectoryName(compiler)); - throw new ApplicationException("Wix tools cannot be found"); - } - - if (Compiler.IsWix4) - { - string wxsFile = BuildWxs(project, type); - - string outDir = IO.Path.GetDirectoryName(wxsFile); - string msiFile = IO.Path.ChangeExtension(wxsFile, "." + type.ToString().ToLower()); - - string wixCmd = GenerateWixCommand(project, wxsFile, out string extensionDlls); - - using (var sw = new IO.StreamWriter(batchFile)) - { - sw.WriteLine("echo off"); - // sw.WriteLine("@setlocal"); - // sw.WriteLine(wixLocationEnvVar); - sw.WriteLine($"\"{wix}\" build {wixCmd} -o \"{outDir.PathJoin(msiFile)}\""); - // sw.WriteLine("if ERRORLEVEL 1 @echo wix.exe failed & GOTO ERROR"); - // sw.WriteLine("@endlocal"); - // sw.WriteLine("EXIT /B 0"); - // sw.WriteLine(":ERROR"); - // sw.WriteLine("@endlocal"); - // sw.WriteLine("EXIT /B 1"); - } + throw new ApplicationException("Wix compiler/linker cannot be found"); } else { @@ -728,32 +679,6 @@ This code was generated by WixSharp. IO.File.WriteAllLines(dest, content.ToArray()); } - static string GenerateWixCommand(Project project, string wxsFile, out string extensionDlls) - { - // Debug.Assert(false); - // objFile = IO.Path.ChangeExtension(wxsFile, ".wixobj"); - - extensionDlls = project.WixExtensions - .Select(x => x.ExpandEnvVars().PathGetFullPath()) - .Distinct() - .JoinBy(" ", dll => " -ext \"" + dll + "\""); - - string wxsFiles = project.WxsFiles - .Select(x => x.ExpandEnvVars().PathGetFullPath()) - .Distinct() - .JoinBy(" ", file => "\"" + file + "\""); - - var candleOptions = WixOptions + " " + project.WixOptions; - - var candleCmdLineParams = new StringBuilder(); - candleCmdLineParams.AppendFormat("{0} {1} \"{2}\" ", candleOptions, extensionDlls, wxsFile); - - if (wxsFiles.IsNotEmpty()) - candleCmdLineParams.Append(wxsFiles); - - return candleCmdLineParams.ToString().ExpandEnvVars(); - } - static string GenerateCandleCommand(Project project, string wxsFile, string outDir, out string objFile, out string extensionDlls) { // Debug.Assert(false); @@ -1057,7 +982,7 @@ public StringWriterWithEncoding(Encoding encoding) static void IndjectCustomUI(Controls.CustomUI customUI, XDocument doc) { if (customUI != null) - doc.Root.Select(Compiler.ProductElementName).Add(customUI.ToXElement()); + doc.Root.Select("Product").Add(customUI.ToXElement()); } /// @@ -1067,7 +992,7 @@ static void IndjectCustomUI(Controls.CustomUI customUI, XDocument doc) public static void DefaultWixSourceGeneratedHandler(XDocument doc) { XElement[] extract(string name) - => doc.Root.Select(Compiler.ProductElementName) + => doc.Root.Select("Product") .Elements() .Where(e => { @@ -1090,13 +1015,13 @@ XElement[] extract(string name) foreach (var e in orderedElements) { e.Remove(); - doc.Root.Select(Compiler.ProductElementName).Add(e); + doc.Root.Select("Product").Add(e); } } static void ConvertMsiToMsm(XDocument doc) { - XElement[] extract(string name) => (from e in doc.Root.Select(Compiler.ProductElementName).Elements() + XElement[] extract(string name) => (from e in doc.Root.Select("Product").Elements() where e.Name.LocalName == name select e).ToArray(); @@ -1108,7 +1033,7 @@ XElement[] extract(string name) => (from e in doc.Root.Select(Compiler.ProductEl foreach (var e in elementsToRemove) e.Remove(); - XElement product = doc.Root.Select(Compiler.ProductElementName); + XElement product = doc.Root.Select("Product"); product.Remove(); XElement module = doc.Root.AddElement(new XElement("Module", product.Elements())); @@ -1212,37 +1137,26 @@ public static XDocument GenerateWixProj(Project project) .Select(x => x.StartsWith("xmlns:") ? x : "xmlns:" + x) .ConcatItems(" "); - XDocument doc; - XElement product; + var wix3Namespace = "http://schemas.microsoft.com/wix/2006/wi"; + var wix4Namespace = "http://wixtoolset.org/schemas/v4/wxs"; - if (Compiler.IsWix4) - { - doc = XDocument.Parse($@" - - - - - "); + var wixNamespace = Compiler.IsWix4 ? wix4Namespace : wix3Namespace; + + XDocument doc = XDocument.Parse( + @" + + + + + "); - product = doc.Root.Select("Package"); // in WiX v4 `Product` is merged with `Package` - product.SetAttribute("ProductCode", project.ProductId); - } - else - { - doc = XDocument.Parse($@" - - - - - "); - product = doc.Root.Select("Product") - .SetAttribute("Codepage", project.Codepage) - .SetAttribute("id", project.ProductId); - } - product.SetAttribute("Name", project.Name) + XElement product = doc.Root.Select("Product"); + product.SetAttribute("Id", project.ProductId) + .SetAttribute("Name", project.Name) .SetAttribute("Language", project.Language.FirstLcid()) + .SetAttribute("Codepage", project.Codepage) .SetAttribute("Version", project.Version) .SetAttribute("UpgradeCode", project.UpgradeCode); @@ -1251,18 +1165,15 @@ public static XDocument GenerateWixProj(Project project) product.AddAttributes(project.Attributes); - XElement package = doc.Root.Select("Package"); + XElement package = product.Select("Package"); package.SetAttribute("Description", project.Description) .SetAttribute("Platform", project.Platform) + .SetAttribute("SummaryCodepage", project.Codepage) .SetAttribute("InstallPrivileges", project.InstallPrivileges) - .SetAttribute("InstallerVersion", project.InstallerVersion) .SetAttribute("InstallScope", project.InstallScope); - if (!Compiler.IsWix4) - package.SetAttribute("SummaryCodepage", project.Codepage); - - if (!project.SuppressSettingPackageLanguages && !Compiler.IsWix4) + if (!project.SuppressSettingPackageLanguages) package.SetAttribute("Languages", project.Language.ToLcidList()); if (project.EmitConsistentPackageId) @@ -1342,11 +1253,7 @@ public static XDocument GenerateWixProj(Project project) .SetAttribute("Value", installDirId); } - // to avoid "error WIX0094: The identifier 'WixUI:WixUI_Minimal' is inaccessible due to its protection level." - if (!Compiler.IsWix4 || project.UI != WUI.WixUI_Minimal) - product.AddElement("UIRef", $"Id={project.UI}"); - - + product.AddElement("UIRef", $"Id={project.UI}"); product.AddElement("UIRef", "Id=WixUI_ErrorProgressText"); project.Include(WixExtension.UI); @@ -1863,7 +1770,7 @@ static void ProcessDirectoryFiles(Dir wDir, Project wProject, Dictionary(); var uniqueComponentWebSites = new List(); @@ -2716,8 +2623,6 @@ static void ProcessCustomActions(Project wProject, XElement product) { foreach (Action wAction in wProject.Actions) { - object wActionCondition = wAction.ToXmlCondition(); - string step = wAction.Step.ToString(); string roollbackActionId = wAction.Id + "_Rollback"; @@ -2779,7 +2684,7 @@ static void ProcessCustomActions(Project wProject, XElement product) .AddAttributes(wAction.Attributes)); sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", actionId), sequenceNumberAttr))); } @@ -2788,7 +2693,7 @@ static void ProcessCustomActions(Project wProject, XElement product) var wScriptAction = (ScriptFileAction)wAction; sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); @@ -2798,7 +2703,7 @@ static void ProcessCustomActions(Project wProject, XElement product) product.Add(new XElement("CustomAction", new XAttribute("Id", wAction.Id), - new XAttribute(CABinarykeyAttrName, wAction.Name.Expand() + "_File"), + new XAttribute("BinaryKey", wAction.Name.Expand() + "_File"), new XAttribute("VBScriptCall", wScriptAction.Procedure)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -2808,13 +2713,13 @@ static void ProcessCustomActions(Project wProject, XElement product) if ((wScriptAction.Execute == Execute.deferred) && wScriptAction.Rollback.IsNotEmpty()) { sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wScriptAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); product.AddElement(new XElement("CustomAction", new XAttribute("Id", roollbackActionId), - new XAttribute(CABinarykeyAttrName, wAction.Name.Expand() + "_File"), + new XAttribute("BinaryKey", wAction.Name.Expand() + "_File"), new XAttribute("VBScriptCall", wScriptAction.RollbackArg)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -2827,8 +2732,7 @@ static void ProcessCustomActions(Project wProject, XElement product) var wScriptAction = (ScriptAction)wAction; sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", - wAction.ToXmlCondition(), + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); @@ -2844,7 +2748,7 @@ static void ProcessCustomActions(Project wProject, XElement product) if ((wScriptAction.Execute == Execute.deferred) && wScriptAction.Rollback.IsNotEmpty()) { sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wScriptAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); @@ -2928,13 +2832,13 @@ static void ProcessCustomActions(Project wProject, XElement product) } } - sequences.ForEach(item => item.Add(new XElement("Custom", wActionCondition, + sequences.ForEach(item => item.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); product.Add(new XElement("CustomAction", new XAttribute("Id", wAction.Id), - new XAttribute(CABinarykeyAttrName, bynaryKey), + new XAttribute("BinaryKey", bynaryKey), new XAttribute("DllEntry", wManagedAction.MethodName)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -2956,14 +2860,14 @@ static void ProcessCustomActions(Project wProject, XElement product) } sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); product.AddElement( new XElement("CustomAction", new XAttribute("Id", roollbackActionId), - new XAttribute(CABinarykeyAttrName, bynaryKey), + new XAttribute("BinaryKey", bynaryKey), new XAttribute("DllEntry", wManagedAction.Rollback)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -2975,7 +2879,7 @@ static void ProcessCustomActions(Project wProject, XElement product) { var wCustomActionRef = (CustomActionRef)wAction; sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wCustomActionRef.Condition.ToXValue(), new XAttribute("Action", wCustomActionRef.Id), new XAttribute(wCustomActionRef.When.ToString(), wCustomActionRef.Step)))); @@ -2998,7 +2902,7 @@ static void ProcessCustomActions(Project wProject, XElement product) product.AddElement( new XElement("CustomAction") .SetAttribute("Id", cmdLineActionId) - .SetAttribute(CABinarykeyAttrName, "WixCA") + .SetAttribute("BinaryKey", "WixCA") .SetAttribute("DllEntry", quietExecAction.ActionName) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -3007,13 +2911,13 @@ static void ProcessCustomActions(Project wProject, XElement product) sequences.ForEach(sequence => sequence.Add( - new XElement("Custom", wActionCondition, + new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", setCmdLineActionId), sequenceNumberAttr))); sequences.ForEach(sequence => sequence.Add( - new XElement("Custom", wActionCondition, + new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", cmdLineActionId), new XAttribute("After", setCmdLineActionId)))); @@ -3026,14 +2930,14 @@ static void ProcessCustomActions(Project wProject, XElement product) new XAttribute("Value", "\"" + quietExecAction.Rollback.ExpandCommandPath() + "\" " + quietExecAction.RollbackArg.ExpandCommandPath()))); sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); product.AddElement( new XElement("CustomAction") .SetAttribute("Id", roollbackActionId) - .SetAttribute(CABinarykeyAttrName, "WixCA") + .SetAttribute("BinaryKey", "WixCA") .SetAttribute("DllEntry", quietExecAction.ActionName) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) @@ -3049,7 +2953,7 @@ static void ProcessCustomActions(Project wProject, XElement product) sequences.ForEach(sequence => sequence.Add( - new XElement("Custom", wActionCondition, + new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); @@ -3066,7 +2970,7 @@ static void ProcessCustomActions(Project wProject, XElement product) if ((fileAction.Execute == Execute.deferred) && fileAction.Rollback.IsNotEmpty()) { sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); @@ -3089,7 +2993,7 @@ static void ProcessCustomActions(Project wProject, XElement product) sequences.ForEach(sequence => sequence.Add( - new XElement("Custom", wActionCondition, + new XElement("Custom", wAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); @@ -3097,7 +3001,7 @@ static void ProcessCustomActions(Project wProject, XElement product) new XElement("CustomAction", new XAttribute("Id", wAction.Id), new XAttribute("ExeCommand", binaryAction.Args.ExpandCommandPath()), - new XAttribute(CABinarykeyAttrName, binaryAction.Key)) + new XAttribute("BinaryKey", binaryAction.Key)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) .SetAttribute("Execute", wAction.Execute) @@ -3106,7 +3010,7 @@ static void ProcessCustomActions(Project wProject, XElement product) if ((binaryAction.Execute == Execute.deferred) && binaryAction.Rollback.IsNotEmpty()) { sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", binaryAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); @@ -3116,7 +3020,7 @@ static void ProcessCustomActions(Project wProject, XElement product) new XAttribute("ExeCommand", binaryAction.RollbackArg.IsEmpty() ? binaryAction.Args.ExpandCommandPath() : binaryAction.RollbackArg.ExpandCommandPath()), - new XAttribute(CABinarykeyAttrName, binaryAction.Rollback)) + new XAttribute("BinaryKey", binaryAction.Rollback)) .SetAttribute("Return", wAction.Return) .SetAttribute("Impersonate", wAction.Impersonate) .SetAttribute("Execute", Execute.rollback) @@ -3129,7 +3033,7 @@ static void ProcessCustomActions(Project wProject, XElement product) sequences.ForEach(sequence => sequence.Add( - new XElement("Custom", wActionCondition, + new XElement("Custom", fileAction.Condition.ToXValue(), new XAttribute("Action", wAction.Id), sequenceNumberAttr))); @@ -3150,7 +3054,7 @@ static void ProcessCustomActions(Project wProject, XElement product) if ((fileAction.Execute == Execute.deferred) && fileAction.Rollback.IsNotEmpty()) { sequences.ForEach(sequence => - sequence.Add(new XElement("Custom", wActionCondition, + sequence.Add(new XElement("Custom", fileAction.Condition.ToXValue(), new XAttribute("Action", roollbackActionId), new XAttribute("Before", wAction.Id)))); @@ -3313,22 +3217,8 @@ static void PackageManagedAsm(string asm, string nativeDll, string[] refAssembli if (platform.HasValue && platform.Value == Platform.x64) platformDir = "x64"; - string makeSfxCA; - string sfxcaDll; - string dtfWinInstaller; - - if (Compiler.IsWix4) // zos - { - makeSfxCA = @"C:\Users\oleg.shilo\.nuget\packages\wixtoolset.dtf.customaction\4.0.0\tools\WixToolset.Dtf.MakeSfxCA.exe"; - sfxcaDll = $@"C:\Users\oleg.shilo\.nuget\packages\wixtoolset.dtf.customaction\4.0.0\tools\{platformDir}\SfxCA.dll"; - dtfWinInstaller = @"C:\Users\oleg.shilo\source\repos\CustomAction1\CustomAction1\publish\WixToolset.Dtf.WindowsInstaller.dll"; - } - else - { - makeSfxCA = Utils.PathCombine(WixSdkLocation, @"MakeSfxCA.exe"); - sfxcaDll = Utils.PathCombine(WixSdkLocation, platformDir + "\\sfxca.dll"); - dtfWinInstaller = WixSdkLocation.PathCombine("WixToolset.Dtf.WindowsInstaller.dll"); - } + var makeSfxCA = Utils.PathCombine(WixSdkLocation, @"MakeSfxCA.exe"); + var sfxcaDll = Utils.PathCombine(WixSdkLocation, platformDir + "\\sfxca.dll"); outDir = IO.Path.GetFullPath(outDir); @@ -3418,7 +3308,10 @@ static void PackageManagedAsm(string asm, string nativeDll, string[] refAssembli (pdbFileArgument ?? " ") + referencedAssemblies; - makeSfxCA_args += $" \"{dtfWinInstaller}\""; + if (IsWix4) + makeSfxCA_args += $" \"{WixSdkLocation.PathCombine("WixToolset.Dtf.WindowsInstaller.dll")}\""; + else + makeSfxCA_args += $" \"{WixSdkLocation.PathCombine("Microsoft.Deployment.WindowsInstaller.dll")}\""; ProjectValidator.ValidateCAAssembly(asmFile); #if DEBUG @@ -3447,25 +3340,10 @@ static void PackageManagedAsm(string asm, string nativeDll, string[] refAssembli /// /// true if this instance is wix4; otherwise, false. /// - public static bool IsWix4 { get; set; } - - /// - /// This property contains the name of the logical 'Product' XML element. The need for this property arises - /// from the changes in WiX v4.0 where 'Product' element was merged with "Package" element. - ///

ThiOn WiX v4.* it is Package

- ///

On WiX v3.* it is Product

- ///

On WiX v4.* it is Package

- ///
- public static string ProductElementName => Compiler.IsWix4 ? "Package" : "Product"; - - /// - /// This property contains the name of the logical 'BinaryKey' XML atribute of the Custom Action element. The need for this property arises - /// from the changes in WiX v4.0 where 'BinaryKey' attribute was been renamed into "BinaryRef". - ///

ThiOn WiX v4.* it is Package

- ///

On WiX v3.* it is

- ///

On WiX v4.* it is

- ///
- internal static string CABinarykeyAttrName => Compiler.IsWix4 ? "BinaryRef" : "BinaryKey"; + public static bool IsWix4 + { + get => false; + } /// /// Gets list of the mapped WiX constants. diff --git a/Source/src/WixSharp/Extensions.cs b/Source/src/WixSharp/Extensions.cs index 35e42123..254cf52f 100644 --- a/Source/src/WixSharp/Extensions.cs +++ b/Source/src/WixSharp/Extensions.cs @@ -5,7 +5,6 @@ using System.Data; using System.Diagnostics; using System.Drawing; -using static System.Environment; using System.Globalization; using System.IO; using System.Linq; @@ -17,15 +16,11 @@ 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; @@ -661,9 +656,9 @@ public static XElement CopyAttributeFrom(this XElement dest, XElement src, strin /// /// This method is nothing else but a 'syntactic sugar' method, which wraps the following code: /// - ///document.Root.Select(Compiler.ProductElementName) + ///document.Root.Select("Product") /// .Add(XDocument.Load(wxsFile) - /// .Root.Select(Compiler.ProductElementName).Elements()); + /// .Root.Select("Product").Elements()); /// /// /// The following is an example of using InjectWxs. @@ -689,9 +684,9 @@ public static XElement CopyAttributeFrom(this XElement dest, XElement src, strin /// public static XDocument InjectWxs(this XDocument document, string wxsFile) { - document.Root.Select(Compiler.ProductElementName) + document.Root.Select("Product") .Add(XDocument.Load(wxsFile) - .Root.Select(Compiler.ProductElementName).Elements()); + .Root.Select("Product").Elements()); return document; } @@ -2810,7 +2805,7 @@ public static bool IsCancelled(this Session session) { try { - session.Message(WixToolset.Dtf.WindowsInstaller.InstallMessage.ActionData, new Record()); + session.Message(Microsoft.Deployment.WindowsInstaller.InstallMessage.ActionData, new Record()); } catch (InstallCanceledException) { @@ -3898,117 +3893,6 @@ public XmlAttribute(string name, bool isCData) /// public static class ProcessExtensions { - // public static string[] FindAssembliesOf(IEnumerable packages) - // { - // // TODO - // // - create a project template based on "dotnet new classlib" output - // // - analyse only directories that are listed in `*.nuget.cache` file (e.g. test\obj\project.nuget.cache) - - // var result = new List(); - - // var projectDir = SpecialFolder.LocalApplicationData.GetPath("Temp", "csscript.core", "nuget", Guid.NewGuid().ToString()); - // Directory.CreateDirectory(projectDir); - - // var packagsSection = ""; - // var restoreArgs = ""; - - // try - // { - // var projectFile = projectDir.PathJoin("nuget.ref.csproj"); - - // File.WriteAllText(projectFile, $@" - // - // net472 - // - - // - // - // - - // - // - // - // - // "); - - // packages = packages.OrderBy(x => x).ToArray(); - - // var sw = Stopwatch.StartNew(); - // Console.WriteLine("Restoring packages..."); - // // Console.WriteLine(packages.JoinBy(NewLine)); - - // var p = new Process(); - // p.StartInfo.FileName = "dotnet"; - // p.StartInfo.Arguments = "restore " + restoreArgs.Trim(); - // p.StartInfo.WorkingDirectory = projectDir; - // p.StartInfo.RedirectStandardOutput = true; - // p.Start(); - // p.WaitForExit(); - - // p = new Process(); - // p.StartInfo.FileName = "dotnet"; - // p.StartInfo.Arguments = "publish --no-restore -o ./publish"; - // p.StartInfo.WorkingDirectory = projectDir; - // p.StartInfo.RedirectStandardOutput = true; - // p.Start(); - // p.WaitForExit(); - - // var allRefAssemblies = Directory.GetFiles(Path.Combine(projectDir, "publish"), "*.dll") - // .Concat( - // Directory.GetFiles(Path.Combine(projectDir, "publish"), "*.exe")) - // .Where(x => !x.EndsWith("nuget.ref.dll")) - // .OrderBy(x => x); - - // bool isSameData(byte[] a, byte[] b) - // { - // if (a.Length == b.Length) - // { - // for (int i = 0; i < a.Length; i++) - // if (a[i] != b[i]) - // return false; - // return true; - // } - // else - // return false; - // } - - // // Console.WriteLine(" " + sw.Elapsed.ToString()); - // sw.Restart(); - // Console.WriteLine("Mapping packages to assemblies1111..."); - // // Debug.Assert(false); - - // foreach (var x in allRefAssemblies) - // { - // var packageName = Path.GetFileNameWithoutExtension(x); - - // var refAssemblyVersion = FileVersionInfo.GetVersionInfo(x).FileVersion; - // var refAssemblySize = new FileInfo(x).Length; - // byte[] refAssemblyBytes = File.ReadAllBytes(x); - - // var matchingAssemblies = Directory - // // .GetDirectories(nugetRepo, $"{packageName}*") // quicker but less reliable as the package name may not be the same as the assembly name. IE `ICSharpCode.SharpZipLib.dll` vs `SharpZipLib.dll` - // .GetDirectories(NuGetCache, $"*") - // .SelectMany(d => Directory - // .GetFiles(d, Path.GetFileName(x), SearchOption.AllDirectories) - // .Where(f => - // refAssemblyVersion == FileVersionInfo.GetVersionInfo(f).FileVersion - // && refAssemblySize == new FileInfo(f).Length - // && isSameData(refAssemblyBytes, File.ReadAllBytes(f)) - // )); - - // var assembly = matchingAssemblies.FirstOrDefault() ?? $"{packageName} - not found"; - // result.Add(assembly); - // } - // // Console.WriteLine(" " + sw.Elapsed.ToString()); - // } - // finally - // { - // try { Directory.Delete(projectDir, true); } - // catch { } - // } - // return result.ToArray(); - // } - /// /// Starts a process resource by specifying the name of an application and a set of /// command-line arguments, and associates the resource with a new diff --git a/Source/src/WixSharp/Feature.cs b/Source/src/WixSharp/Feature.cs index 075a611f..c66286c7 100644 --- a/Source/src/WixSharp/Feature.cs +++ b/Source/src/WixSharp/Feature.cs @@ -223,7 +223,7 @@ public Feature(string name, string description, bool isEnabled, bool allowChange /// /// The default path of the feature ConfigurableDirectory. If set to non-empty string, MSI runtime will place /// Configure button for the feature in the Feature Selection dialog. - /// Specify the Id of a Directory that can be configured by the user at installation + /// Specify the Id of a Directory that can be configured by the user at installation /// time. This identifier must be a public property and therefore completely uppercase. /// public string ConfigurableDir = ""; @@ -274,17 +274,13 @@ internal XElement ToXml() var element = new XElement("Feature"); element.SetAttribute("Id", Id) .SetAttribute("Title", Name) + .SetAttribute("Absent", AllowChange ? "allow" : "disallow") .SetAttribute("Level", IsEnabled ? "1" : "2") .SetAttribute("Description", Description) .SetAttribute("Display", Display) .SetAttribute("ConfigurableDirectory", ConfigurableDir) .AddAttributes(Attributes); - if (Compiler.IsWix4) - element.SetAttribute("AllowAbsent", AllowChange.ToYesNo()); - else - element.SetAttribute("Absent", AllowChange ? "allow" : "disallow"); - if (Condition != null) element.Add( //intentionally leaving out AddAttributes(...) as Level is the only valid attribute on */Feature/Condition new XElement("Condition", diff --git a/Source/src/WixSharp/InternetShortcut.cs b/Source/src/WixSharp/InternetShortcut.cs index c7b2a27c..80ffdece 100644 --- a/Source/src/WixSharp/InternetShortcut.cs +++ b/Source/src/WixSharp/InternetShortcut.cs @@ -7,17 +7,13 @@ 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 { diff --git a/Source/src/WixSharp/ManagedAction.cs b/Source/src/WixSharp/ManagedAction.cs index 960a64e4..a7239383 100644 --- a/Source/src/WixSharp/ManagedAction.cs +++ b/Source/src/WixSharp/ManagedAction.cs @@ -28,11 +28,7 @@ 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 { diff --git a/Source/src/WixSharp/ManagedProject/Interfaces.cs b/Source/src/WixSharp/ManagedProject/Interfaces.cs index d32c8104..e684c378 100644 --- a/Source/src/WixSharp/ManagedProject/Interfaces.cs +++ b/Source/src/WixSharp/ManagedProject/Interfaces.cs @@ -1,11 +1,7 @@ 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 diff --git a/Source/src/WixSharp/ManagedProject/ManagedProject.cs b/Source/src/WixSharp/ManagedProject/ManagedProject.cs index 859d44b9..8a9fc072 100644 --- a/Source/src/WixSharp/ManagedProject/ManagedProject.cs +++ b/Source/src/WixSharp/ManagedProject/ManagedProject.cs @@ -6,13 +6,8 @@ using System.Linq.Expressions; using System.Reflection; using System.Text; -using WixSharp.CommonTasks; - -#if WIX3 using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif +using WixSharp.CommonTasks; using IO = System.IO; diff --git a/Source/src/WixSharp/ManagedProject/ManagedProjectActions.cs b/Source/src/WixSharp/ManagedProject/ManagedProjectActions.cs index b08960ba..7758aea8 100644 --- a/Source/src/WixSharp/ManagedProject/ManagedProjectActions.cs +++ b/Source/src/WixSharp/ManagedProject/ManagedProjectActions.cs @@ -4,12 +4,8 @@ using System.Linq.Expressions; using System.Runtime.InteropServices; using System.Windows.Forms; -using WixSharp.CommonTasks; -#if WIX3 using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif +using WixSharp.CommonTasks; namespace WixSharp { diff --git a/Source/src/WixSharp/ManagedProject/SetupEventArgs.cs b/Source/src/WixSharp/ManagedProject/SetupEventArgs.cs index e619ca74..188b5ebc 100644 --- a/Source/src/WixSharp/ManagedProject/SetupEventArgs.cs +++ b/Source/src/WixSharp/ManagedProject/SetupEventArgs.cs @@ -2,13 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Security.Principal; -using WixSharp.CommonTasks; - -#if WIX3 using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif +using WixSharp.CommonTasks; namespace WixSharp { diff --git a/Source/src/WixSharp/NativeImage.cs b/Source/src/WixSharp/NativeImage.cs index e8fd3844..f39b041a 100644 --- a/Source/src/WixSharp/NativeImage.cs +++ b/Source/src/WixSharp/NativeImage.cs @@ -7,15 +7,11 @@ 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 diff --git a/Source/src/WixSharp/ProjectValidator.cs b/Source/src/WixSharp/ProjectValidator.cs index 81066b00..d2ac94e2 100644 --- a/Source/src/WixSharp/ProjectValidator.cs +++ b/Source/src/WixSharp/ProjectValidator.cs @@ -36,12 +36,9 @@ THE SOFTWARE. using System.Linq; using System.Reflection; using System.Text; -using WixSharp.CommonTasks; -#if WIX3 using Microsoft.Deployment.WindowsInstaller; -#else -using WixToolset.Dtf.WindowsInstaller; -#endif +using WixSharp.CommonTasks; + using IO = System.IO; using Reflection = System.Reflection; diff --git a/Source/src/WixSharp/ResilientPackage.cs b/Source/src/WixSharp/ResilientPackage.cs index d3ed7502..dec2de32 100644 --- a/Source/src/WixSharp/ResilientPackage.cs +++ b/Source/src/WixSharp/ResilientPackage.cs @@ -2,15 +2,9 @@ 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 @@ -71,7 +65,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; @@ -99,7 +93,7 @@ public static void EnableResilientPackage(this Project project, string resilient { UsesProperties = $"UserSID,OriginalDatabase,ALLUSERS,{WIXSHARP_RESILIENT_SOURCE_DIR}" } - ); + ); } /// diff --git a/Source/src/WixSharp/UACRevealer.cs b/Source/src/WixSharp/UACRevealer.cs index c0ea43a0..901e38ac 100644 --- a/Source/src/WixSharp/UACRevealer.cs +++ b/Source/src/WixSharp/UACRevealer.cs @@ -11,14 +11,10 @@ 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 { diff --git a/Source/src/WixSharp/UninstallFullUI.cs b/Source/src/WixSharp/UninstallFullUI.cs index 47bafd15..a2c7fdde 100644 --- a/Source/src/WixSharp/UninstallFullUI.cs +++ b/Source/src/WixSharp/UninstallFullUI.cs @@ -1,13 +1,8 @@ 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 { /// @@ -84,7 +79,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 diff --git a/Source/src/WixSharp/WixExtension.cs b/Source/src/WixSharp/WixExtension.cs index c27722d1..4252d777 100644 --- a/Source/src/WixSharp/WixExtension.cs +++ b/Source/src/WixSharp/WixExtension.cs @@ -199,11 +199,7 @@ public static string GetNamespaceDeclaration(string prefix, string @namespace) /// /// Well-known Wix Extension UI /// -#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 } /// diff --git a/Source/src/WixSharp/WixProject.cs b/Source/src/WixSharp/WixProject.cs index dd5fd887..6a26d66b 100644 --- a/Source/src/WixSharp/WixProject.cs +++ b/Source/src/WixSharp/WixProject.cs @@ -164,11 +164,6 @@ public string Language /// public string CandleOptions = ""; - /// - /// WiX compiler wix.exe options (e.g. "-define DEBUG"). Available only in WiX v4.* - /// - public string WixOptions = ""; - /// /// Occurs when WiX source code generated. Use this event if you need to modify generated XML (XDocument) /// before it is compiled into MSI. diff --git a/Source/src/WixSharp/WixSharp.csproj b/Source/src/WixSharp/WixSharp.csproj index a16aa6a2..1632e36b 100644 --- a/Source/src/WixSharp/WixSharp.csproj +++ b/Source/src/WixSharp/WixSharp.csproj @@ -281,11 +281,6 @@ WixSharp.Msi - - - 4.0.0 - -