From 25602a3e613f09794599d24e0c796d3295a22197 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 23 Jun 2020 23:26:22 -0400 Subject: Reference Media if DiskId is specified. --- src/WixToolset.Core/Bind/FileFacade.cs | 2 +- src/WixToolset.Core/Compiler.cs | 10 +++++----- .../TestData/MultiFileCompressed/PackageComponents.wxs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index f0ce14ca..511f4aab 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs @@ -56,7 +56,7 @@ namespace WixToolset.Core.Bind public int DiskId { - get => this.FileRow == null ? this.FileTuple.DiskId ?? 0 : this.FileRow.DiskId; + get => this.FileRow == null ? this.FileTuple.DiskId ?? 1 : this.FileRow.DiskId; set { if (this.FileRow == null) diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index e2a5721e..56f6322a 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -5728,11 +5728,6 @@ namespace WixToolset.Core id = this.Core.CreateIdentifier("fil", directoryId, name ?? shortName); } - if (!this.compilingModule && CompilerConstants.IntegerNotSet == diskId) - { - diskId = 1; // default to first Media - } - if (null != defaultVersion && null != companionFile) { this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DefaultVersion", "CompanionFile", companionFile)); @@ -5914,6 +5909,11 @@ namespace WixToolset.Core } } + if (CompilerConstants.IntegerNotSet != diskId) + { + this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Media, diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); + } + // If this component does not have a companion file this file is a possible keypath. possibleKeyPath = null; if (null == companionFile) diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs index 1a040fa3..82797ebe 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs @@ -3,10 +3,10 @@ - + - + -- cgit v1.2.3-55-g6feb