Warn on mismatched output times and validate only Windows Installer databases
Fixes 7250
Rob Mensching committed
Mar 9, 2023 at 04:13 UTC
a14cb82fcca0b5522dfefe862493ad2e51240a84
6 files changed
+22
-11
src/api/wix/WixToolset.Data/WarningMessages.cs
+2
-2
@@ -613,9 +613,9 @@ namespace WixToolset.Data
613
return Message(sourceLineNumbers, Ids.UnclearShortcut, "Because it is an advertised shortcut, the target of shortcut '{0}' will be the keypath of component '{2}' rather than parent file '{1}'. To eliminate this warning, you can (1) make the Shortcut element a child of the File element that is the keypath of component '{2}', (2) make file '{1}' the keypath of component '{2}', or (3) remove the @Advertise attribute so the shortcut is a non-advertised shortcut.", shortcutId, fileId, componentId);
614
}
615
616
- public static Message UnexpectedEntrySection(SourceLineNumber sourceLineNumbers, string sectionType, string expectedType, string outputExtension)
616
+ public static Message UnexpectedEntrySection(SourceLineNumber sourceLineNumbers, string sectionType, string expectedType)
617
{
618
- return Message(sourceLineNumbers, Ids.UnexpectedEntrySection, "Found mismatched entry point <{0}>. Expected <{1}> for specified output package type {2}.", sectionType, expectedType, outputExtension);
618
+ return Message(sourceLineNumbers, Ids.UnexpectedEntrySection, "Found entry point <{0}> that does not match expected <{1}> output type. Verify that your source code is correct and matches the expected output type.", sectionType, expectedType);
619
}
620
621
public static Message UnexpectedTableInProduct(SourceLineNumber sourceLineNumbers, string tableName)
src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+1
-1
@@ -301,7 +301,7 @@ namespace WixToolsetTest.Util
301
public void CanBuildModuleWithXmlConfig()
302
{
303
var folder = TestData.Get(@"TestData", "XmlConfigModule");
304
- var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder });
304
+ var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }, "test.msm");
305
306
var results = build.BuildAndQuery(BuildX64, "Wix4XmlConfig");
307
WixAssert.CompareLineByLine(new[]
src/wix/WixToolset.Core.WindowsInstaller/CommandLine/ValidateSubcommand.cs
+8
-1
@@ -90,7 +90,14 @@ namespace WixToolset.Core.WindowsInstaller.CommandLine
90
91
if (File.Exists(this.WixpdbPath))
92
{
93
- data = WindowsInstallerData.Load(this.WixpdbPath);
93
+ try
94
+ {
95
+ data = WindowsInstallerData.Load(this.WixpdbPath);
96
+ }
97
+ catch (ArgumentOutOfRangeException)
98
+ {
99
+ this.Messaging.Write(WindowsInstallerBackendErrors.InvalidWindowsInstallerWixpdbForValidation(this.WixpdbPath));
100
+ }
101
}
102
103
var command = new ValidateDatabaseCommand(this.Messaging, this.FileSystem, this.IntermediateFolder, this.DatabasePath, data, this.CubeFiles, this.Ices, this.SuppressIces);
src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendErrors.cs
+6
@@ -29,6 +29,11 @@ namespace WixToolset.Core.WindowsInstaller
29
return Message(originalLineNumber, Ids.InvalidModuleVersion, "The Module/@Version was not be able to be used as a four-part version. A valid four-part version has a max value of \"65535.65535.65535.65535\" and must be all numeric.", version);
30
}
31
32
+ public static Message InvalidWindowsInstallerWixpdbForValidation(string wixpdbPath)
33
+ {
34
+ return Message(null, Ids.InvalidWindowsInstallerWixpdbForValidation, "The validation .wixpdb file: {0} was not from a Windows Installer database build (.msi or .msm). Verify that the output type was actually an MSI Package or Merge Module.", wixpdbPath);
35
+ }
36
+
37
public static Message UnknownDecompileType(string decompileType, string filePath)
38
{
39
return Message(null, Ids.UnknownDecompileType, "Unknown decompile type '{0}' from input: {1}", decompileType, filePath);
@@ -52,6 +57,7 @@ namespace WixToolset.Core.WindowsInstaller
57
ExceededMaximumAllowedFeatureDepthInMsi = 7503,
58
UnknownDecompileType = 7504,
59
UnknownValidationTargetFileExtension = 7505,
60
+ InvalidWindowsInstallerWixpdbForValidation = 7506,
61
} // last available is 7999. 8000 is BurnBackendErrors.
62
}
63
}
src/wix/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
+4
-6
@@ -60,12 +60,10 @@ namespace WixToolset.Core.Link
60
// Try to find the one and only entry section.
61
if (SectionType.Package == section.Type || SectionType.Module == section.Type || SectionType.PatchCreation == section.Type || SectionType.Patch == section.Type || SectionType.Bundle == section.Type)
62
{
63
- // TODO: remove this?
64
- //if (SectionType.Unknown != expectedEntrySectionType && section.Type != expectedEntrySectionType)
65
- //{
66
- // string outputExtension = Output.GetExtension(this.ExpectedOutputType);
67
- // this.Messaging.Write(WixWarnings.UnexpectedEntrySection(section.SourceLineNumbers, section.Type.ToString(), expectedEntrySectionType.ToString(), outputExtension));
68
- //}
63
+ if (SectionType.Unknown != expectedEntrySectionType && section.Type != expectedEntrySectionType)
64
+ {
65
+ this.Messaging.Write(WarningMessages.UnexpectedEntrySection(section.Symbols.FirstOrDefault()?.SourceLineNumbers, section.Type.ToString(), expectedEntrySectionType.ToString()));
66
+ }
67
68
if (null == this.EntrySection)
69
{
src/wix/test/WixToolsetTest.CoreIntegration/ClassFixture.cs
+1
-1
@@ -120,7 +120,7 @@ namespace WixToolsetTest.CoreIntegration
120
{
121
var baseFolder = fs.GetFolder();
122
var intermediateFolder = Path.Combine(baseFolder, "obj");
123
- var msiPath = Path.Combine(baseFolder, @"bin", "test.msi");
123
+ var msiPath = Path.Combine(baseFolder, @"bin", "test.msm");
124
125
var result = WixRunner.Execute(new[]
126
{