Skip to content

Commit

Permalink
Issue #23: Attributes inheritance in Files and DirFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-shilo committed Feb 21, 2017
1 parent 5a7901f commit 2cb3eed
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 144 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 10 additions & 3 deletions Source/src/WixSharp.Samples/Wix# Samples/InjectXML/setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ static public void Main(string[] args)

//project specific build event
project.WixSourceGenerated += InjectImages;

project.WixSourceGenerated += document =>
{
document.Root.Select("Product")
.AddElement("MediaTemplate", "CabinetTemplate=cab{0}.cab, CompressionLevel=mszip");
};

//global build event
Compiler.WixSourceGenerated += document =>
{
Expand All @@ -51,7 +58,7 @@ static public void Main(string[] args)
document.FindAll("Component")
.ForEach(e => e.SetAttributeValue("Win64", "yes"));
//merge 'Wix/Product' elements of document with 'Wix/Product' elements of CommonProperies.wxs
//merge 'Wix/Product' elements of document with 'Wix/Product' elements of CommonProperies.wxs
document.InjectWxs("CommonProperies.wxs");
//the commented code below is the equivalent of project.AddXmlInclude(...)
Expand Down Expand Up @@ -94,12 +101,12 @@ public void Process(ProcessingContext context)
var util = WixExtension.Util;

//reflect new dependency
context.Project.IncludeWixExtension(util);
context.Project.IncludeWixExtension(util);

//serialize itself and add to the parent component
context.XParent
.FindSingle("Component")
.Add(this.ToXElement(util, "EventSource"));
.Add(this.ToXElement(util, "EventSource"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ static public void Main(string[] args)
{
NeverOverwrite = true
}),
new Media(),
new Media(),
new Property("PropName", "<your value>"));

//project.UI = WUI.WixUI_InstallDir;
Expand All @@ -34,8 +36,7 @@ static public void Main(string[] args)

project.WixSourceGenerated += Compiler_WixSourceGenerated;

project.BuildWxs();
//project.BuildMsi();
project.BuildMsi();
}

static void Compiler_WixSourceGenerated(XDocument document)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static public void Main(string[] args)
new Project("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",

//new Dir("Documentation", new Files(@"\\BUILDSERVER\My Product\Release\Documentation\*.*")), //uncomment if you have a real remote files to install
//new Dir("Documentation", new Files(@"\\BUILDSERVER\My Product\Release\Documentation\*.*")), //uncomment if you have a real remote files to install

new Files(@"..\Release Folder\Release\*.*",
f => !f.EndsWith(".obj") &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Script
static public void Main(string[] args)
{
//Note that if the install condition for the component can be set without interacting with user (e.g. analyzing registry)
//as part InstallExecuteSequence. However if interaction is required (e.g. message box, checkbox) install condition should
//as part InstallExecuteSequence. However if interaction is required (e.g. message box, checkbox) install condition should
//be set form InstallUISequence.

var project =
Expand Down
Binary file modified Source/src/WixSharp.Samples/WixSharp.UI.dll
Binary file not shown.
Binary file modified Source/src/WixSharp.Samples/WixSharp.dll
Binary file not shown.
165 changes: 89 additions & 76 deletions Source/src/WixSharp.Samples/WixSharp.xml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Source/src/WixSharp.Test/IssueFixesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public void Fix_Issue_67()
var file = project.BuildWxs();
}

[Fact]
public void ListConsts()
{
var list = Compiler.GetMappedWixConstants(true);
}

[Fact]
[Description("Issue #60")]
public void Fix_Issue_60()
Expand Down
3 changes: 2 additions & 1 deletion Source/src/WixSharp/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,8 @@ public static XDocument GenerateWixProj(Project project)
package.CopyAttributeFrom(product, "Id");

package.AddAttributes(project.Package.Attributes);
product.Add(project.Media.ToXml((project as WixEntity).Id));
foreach(Media item in project.Media)
product.Add(item.ToXml((project as WixEntity).Id));

ProcessWixVariables(project, product);
ProcessLaunchConditions(project, product);
Expand Down
8 changes: 4 additions & 4 deletions Source/src/WixSharp/Media.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace WixSharp
/// new Project("My Product",
/// new Dir(@"%ProgramFiles%\My Company\My Product",
/// ...
/// project.Media.Id=2;
/// project.Media.CompressionLevel=CompressionLevel.high;
/// project.Media.First().Id=2;
/// project.Media.First().CompressionLevel=CompressionLevel.high;
/// //or
/// project.Media.AttributesDefinition = @"CompressionLevel=high;
/// Id=2";
/// project.Media.First().AttributesDefinition = @"CompressionLevel=high;
/// Id=2";
/// Compiler.BuildMsi(project);
/// </code>
/// </example>
Expand Down
Loading

0 comments on commit 2cb3eed

Please sign in to comment.