Skip to content

Commit

Permalink
- Master: undone some Wix4 preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-shilo committed Apr 12, 2023
1 parent 9fa5281 commit c20c881
Show file tree
Hide file tree
Showing 34 changed files with 122 additions and 450 deletions.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion Source/src/WixSharp.Samples/Wix# Samples/Extensions/setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
/// </code>
///
/// </summary>

class Script
{
static public void Main()
Expand Down Expand Up @@ -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");
}
Expand Down
Binary file not shown.
26 changes: 13 additions & 13 deletions Source/src/WixSharp.Samples/Wix# Samples/IIS/XMLInjection/setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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");

Expand All @@ -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;

Expand All @@ -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"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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;
Expand All @@ -58,7 +53,7 @@ static public void Main()

project.WixSourceGenerated += Compiler_WixSourceGenerated;

project.BuildMsiCmd();
project.BuildMsi();
}

private static void Compiler_WixSourceGenerated(XDocument document)
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
@"<UI>
@"<UI>
<Publish Dialog=""WelcomeDlg"" Control=""Next"" Event=""NewDialog"" Order=""5"" Value=""InstallDirDlg"">1</Publish>
<Publish Dialog=""InstallDirDlg"" Control=""Back"" Event=""NewDialog"" Order=""5"" Value=""WelcomeDlg"">1</Publish>
</UI>"));
Expand Down
4 changes: 2 additions & 2 deletions Source/src/WixSharp.Test/IssueFixesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 0 additions & 8 deletions Source/src/WixSharp/Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ THE SOFTWARE.

#endregion Licence...

using System.Xml.Linq;

namespace WixSharp
{
/// <summary>
Expand Down Expand Up @@ -176,12 +174,6 @@ 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
10 changes: 5 additions & 5 deletions Source/src/WixSharp/AutoElements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
{
Expand Down Expand Up @@ -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")
Expand All @@ -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"))
Expand Down Expand Up @@ -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"))
Expand Down
4 changes: 0 additions & 4 deletions Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Source/src/WixSharp/ComRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public AppId()
/// <exception cref="ValidationException"></exception>
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))
Expand Down
10 changes: 3 additions & 7 deletions Source/src/WixSharp/CommonTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}");
// };
// }
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions Source/src/WixSharp/Compiler.Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit c20c881

Please sign in to comment.