diff options
-rw-r--r-- | src/wix/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs | 39 | ||||
-rw-r--r-- | src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindTransformCommand.cs | 4 |
2 files changed, 21 insertions, 22 deletions
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs index faa03762..575065bb 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/GenerateTransformCommand.cs | |||
@@ -75,7 +75,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
75 | 75 | ||
76 | this.transformSummaryInfo = new SummaryInformationStreams(); | 76 | this.transformSummaryInfo = new SummaryInformationStreams(); |
77 | 77 | ||
78 | // compare the codepages | 78 | // Compare the codepages. |
79 | if (targetOutput.Codepage != updatedOutput.Codepage && 0 == (TransformFlags.ErrorChangeCodePage & validationFlags)) | 79 | if (targetOutput.Codepage != updatedOutput.Codepage && 0 == (TransformFlags.ErrorChangeCodePage & validationFlags)) |
80 | { | 80 | { |
81 | this.messaging.Write(ErrorMessages.OutputCodepageMismatch(targetOutput.SourceLineNumbers, targetOutput.Codepage, updatedOutput.Codepage)); | 81 | this.messaging.Write(ErrorMessages.OutputCodepageMismatch(targetOutput.SourceLineNumbers, targetOutput.Codepage, updatedOutput.Codepage)); |
@@ -85,19 +85,18 @@ namespace WixToolset.Core.WindowsInstaller | |||
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | // compare the output types | 88 | // Compare the output types. |
89 | if (targetOutput.Type != updatedOutput.Type) | 89 | if (targetOutput.Type != updatedOutput.Type) |
90 | { | 90 | { |
91 | throw new WixException(ErrorMessages.OutputTypeMismatch(targetOutput.SourceLineNumbers, targetOutput.Type.ToString(), updatedOutput.Type.ToString())); | 91 | throw new WixException(ErrorMessages.OutputTypeMismatch(targetOutput.SourceLineNumbers, targetOutput.Type.ToString(), updatedOutput.Type.ToString())); |
92 | } | 92 | } |
93 | 93 | ||
94 | // compare the contents of the tables | 94 | // Compare the contents of the tables. |
95 | foreach (var targetTable in targetOutput.Tables) | 95 | foreach (var targetTable in targetOutput.Tables) |
96 | { | 96 | { |
97 | var updatedTable = updatedOutput.Tables[targetTable.Name]; | 97 | var updatedTable = updatedOutput.Tables[targetTable.Name]; |
98 | var operation = TableOperation.None; | ||
99 | 98 | ||
100 | var rows = this.CompareTables(targetOutput, targetTable, updatedTable, out operation); | 99 | var rows = this.CompareTables(targetOutput, targetTable, updatedTable, out var operation); |
101 | 100 | ||
102 | if (TableOperation.Drop == operation) | 101 | if (TableOperation.Drop == operation) |
103 | { | 102 | { |
@@ -114,10 +113,10 @@ namespace WixToolset.Core.WindowsInstaller | |||
114 | } | 113 | } |
115 | } | 114 | } |
116 | 115 | ||
117 | // added tables | 116 | // Add all of the rows for tables that only exist in the update. |
118 | foreach (var updatedTable in updatedOutput.Tables) | 117 | foreach (var updatedTable in updatedOutput.Tables) |
119 | { | 118 | { |
120 | if (null == targetOutput.Tables[updatedTable.Name]) | 119 | if (!targetOutput.Tables.TryGetTable(updatedTable.Name, out var _)) |
121 | { | 120 | { |
122 | var addedTable = transform.EnsureTable(updatedTable.Definition); | 121 | var addedTable = transform.EnsureTable(updatedTable.Definition); |
123 | addedTable.Operation = TableOperation.Add; | 122 | addedTable.Operation = TableOperation.Add; |
@@ -131,7 +130,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
131 | } | 130 | } |
132 | } | 131 | } |
133 | 132 | ||
134 | // set summary information properties | 133 | // Set summary information properties. |
135 | if (!this.SuppressKeepingSpecialRows) | 134 | if (!this.SuppressKeepingSpecialRows) |
136 | { | 135 | { |
137 | var summaryInfoTable = transform.Tables["_SummaryInformation"]; | 136 | var summaryInfoTable = transform.Tables["_SummaryInformation"]; |
@@ -319,20 +318,20 @@ namespace WixToolset.Core.WindowsInstaller | |||
319 | var rows = new List<Row>(); | 318 | var rows = new List<Row>(); |
320 | operation = TableOperation.None; | 319 | operation = TableOperation.None; |
321 | 320 | ||
322 | // dropped tables | 321 | // No tables. |
323 | if (null == updatedTable ^ null == targetTable) | 322 | if (null == targetTable && null == updatedTable) |
324 | { | 323 | { |
325 | if (null == targetTable) | ||
326 | { | ||
327 | operation = TableOperation.Add; | ||
328 | rows.AddRange(updatedTable.Rows); | ||
329 | } | ||
330 | else if (null == updatedTable) | ||
331 | { | ||
332 | operation = TableOperation.Drop; | ||
333 | } | ||
334 | } | 324 | } |
335 | else // possibly modified tables | 325 | else if (null == targetTable) // added table. |
326 | { | ||
327 | operation = TableOperation.Add; | ||
328 | rows.AddRange(updatedTable.Rows); | ||
329 | } | ||
330 | else if (null == updatedTable) // removed table. | ||
331 | { | ||
332 | operation = TableOperation.Drop; | ||
333 | } | ||
334 | else // possibly modified table. | ||
336 | { | 335 | { |
337 | var updatedPrimaryKeys = new Dictionary<string, Row>(); | 336 | var updatedPrimaryKeys = new Dictionary<string, Row>(); |
338 | var targetPrimaryKeys = new Dictionary<string, Row>(); | 337 | var targetPrimaryKeys = new Dictionary<string, Row>(); |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindTransformCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindTransformCommand.cs index ea40fa9f..01ff1a80 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindTransformCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindTransformCommand.cs | |||
@@ -67,7 +67,6 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
67 | 67 | ||
68 | // create a schema msi which hopefully matches the table schemas in the transform | 68 | // create a schema msi which hopefully matches the table schemas in the transform |
69 | var schemaOutput = new WindowsInstallerData(null); | 69 | var schemaOutput = new WindowsInstallerData(null); |
70 | var msiDatabaseFile = Path.Combine(this.IntermediateFolder, "schema.msi"); | ||
71 | foreach (var tableDefinition in this.TableDefinitions) | 70 | foreach (var tableDefinition in this.TableDefinitions) |
72 | { | 71 | { |
73 | // skip unreal tables and the Patch table | 72 | // skip unreal tables and the Patch table |
@@ -81,9 +80,10 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
81 | Table transformViewTable; | 80 | Table transformViewTable; |
82 | 81 | ||
83 | // Bind the schema msi. | 82 | // Bind the schema msi. |
83 | var msiDatabaseFile = Path.Combine(this.IntermediateFolder, "schema.msi"); | ||
84 | this.GenerateDatabase(schemaOutput, msiDatabaseFile); | 84 | this.GenerateDatabase(schemaOutput, msiDatabaseFile); |
85 | 85 | ||
86 | // apply the transform to the database and retrieve the modifications | 86 | // Apply the transform to the database and retrieve the modifications. |
87 | using (var msiDatabase = new Database(msiDatabaseFile, OpenDatabase.Transact)) | 87 | using (var msiDatabase = new Database(msiDatabaseFile, OpenDatabase.Transact)) |
88 | { | 88 | { |
89 | // apply the transform with the ViewTransform option to collect all the modifications | 89 | // apply the transform with the ViewTransform option to collect all the modifications |