diff options
Diffstat (limited to 'src/wixext/VSCompiler.cs')
-rw-r--r-- | src/wixext/VSCompiler.cs | 305 |
1 files changed, 179 insertions, 126 deletions
diff --git a/src/wixext/VSCompiler.cs b/src/wixext/VSCompiler.cs index ebf7fa59..b9390fea 100644 --- a/src/wixext/VSCompiler.cs +++ b/src/wixext/VSCompiler.cs | |||
@@ -4,10 +4,13 @@ namespace WixToolset.VisualStudio | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Globalization; | ||
7 | using System.Xml.Linq; | 8 | using System.Xml.Linq; |
8 | using WixToolset.Data; | 9 | using WixToolset.Data; |
10 | using WixToolset.Data.Tuples; | ||
9 | using WixToolset.Data.WindowsInstaller; | 11 | using WixToolset.Data.WindowsInstaller; |
10 | using WixToolset.Extensibility; | 12 | using WixToolset.Extensibility; |
13 | using WixToolset.VisualStudio.Tuples; | ||
11 | 14 | ||
12 | /// <summary> | 15 | /// <summary> |
13 | /// The compiler for the WiX Toolset Visual Studio Extension. | 16 | /// The compiler for the WiX Toolset Visual Studio Extension. |
@@ -79,10 +82,10 @@ namespace WixToolset.VisualStudio | |||
79 | 82 | ||
80 | private void ParseHelpCollectionRefElement(Intermediate intermediate, IntermediateSection section, XElement element) | 83 | private void ParseHelpCollectionRefElement(Intermediate intermediate, IntermediateSection section, XElement element) |
81 | { | 84 | { |
82 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 85 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
83 | Identifier id = null; | 86 | Identifier id = null; |
84 | 87 | ||
85 | foreach (XAttribute attrib in element.Attributes()) | 88 | foreach (var attrib in element.Attributes()) |
86 | { | 89 | { |
87 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 90 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
88 | { | 91 | { |
@@ -90,7 +93,7 @@ namespace WixToolset.VisualStudio | |||
90 | { | 93 | { |
91 | case "Id": | 94 | case "Id": |
92 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); | 95 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
93 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "HelpNamespace", id.Id); | 96 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, VSTupleDefinitions.HelpNamespace, id.Id); |
94 | break; | 97 | break; |
95 | default: | 98 | default: |
96 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 99 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
@@ -108,11 +111,10 @@ namespace WixToolset.VisualStudio | |||
108 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); | 111 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); |
109 | } | 112 | } |
110 | 113 | ||
111 | foreach (XElement child in element.Elements()) | 114 | foreach (var child in element.Elements()) |
112 | { | 115 | { |
113 | if (this.Namespace == child.Name.Namespace) | 116 | if (this.Namespace == child.Name.Namespace) |
114 | { | 117 | { |
115 | SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); | ||
116 | switch (child.Name.LocalName) | 118 | switch (child.Name.LocalName) |
117 | { | 119 | { |
118 | case "HelpFileRef": | 120 | case "HelpFileRef": |
@@ -132,13 +134,13 @@ namespace WixToolset.VisualStudio | |||
132 | 134 | ||
133 | private void ParseHelpCollectionElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) | 135 | private void ParseHelpCollectionElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) |
134 | { | 136 | { |
135 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 137 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
136 | Identifier id = null; | 138 | Identifier id = null; |
137 | string description = null; | 139 | string description = null; |
138 | string name = null; | 140 | string name = null; |
139 | YesNoType suppressCAs = YesNoType.No; | 141 | var suppressCAs = YesNoType.No; |
140 | 142 | ||
141 | foreach (XAttribute attrib in element.Attributes()) | 143 | foreach (var attrib in element.Attributes()) |
142 | { | 144 | { |
143 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 145 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
144 | { | 146 | { |
@@ -169,7 +171,7 @@ namespace WixToolset.VisualStudio | |||
169 | 171 | ||
170 | if (null == id) | 172 | if (null == id) |
171 | { | 173 | { |
172 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); | 174 | id = this.ParseHelper.CreateIdentifier("vshc", fileId, description, name); |
173 | } | 175 | } |
174 | 176 | ||
175 | if (null == description) | 177 | if (null == description) |
@@ -182,7 +184,7 @@ namespace WixToolset.VisualStudio | |||
182 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); | 184 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); |
183 | } | 185 | } |
184 | 186 | ||
185 | foreach (XElement child in element.Elements()) | 187 | foreach (var child in element.Elements()) |
186 | { | 188 | { |
187 | if (this.Namespace == child.Name.Namespace) | 189 | if (this.Namespace == child.Name.Namespace) |
188 | { | 190 | { |
@@ -210,31 +212,33 @@ namespace WixToolset.VisualStudio | |||
210 | 212 | ||
211 | if (!this.Messaging.EncounteredError) | 213 | if (!this.Messaging.EncounteredError) |
212 | { | 214 | { |
213 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpNamespace", id); | 215 | section.AddTuple(new HelpNamespaceTuple(sourceLineNumbers, id) |
214 | row.Set(1, name); | 216 | { |
215 | row.Set(2, fileId); | 217 | NamespaceName = name, |
216 | row.Set(3, description); | 218 | CollectionFileRef = fileId, |
219 | Description = description, | ||
220 | }); | ||
217 | 221 | ||
218 | if (YesNoType.No == suppressCAs) | 222 | if (YesNoType.No == suppressCAs) |
219 | { | 223 | { |
220 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "CA_RegisterMicrosoftHelp.3643236F_FC70_11D3_A536_0090278A1BB8"); | 224 | this.AddReferenceToRegisterMicrosoftHelp(section, sourceLineNumbers); |
221 | } | 225 | } |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
225 | private void ParseHelpFileElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) | 229 | private void ParseHelpFileElement(Intermediate intermediate, IntermediateSection section, XElement element, string fileId) |
226 | { | 230 | { |
227 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 231 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
228 | Identifier id = null; | 232 | Identifier id = null; |
229 | string name = null; | 233 | string name = null; |
230 | int language = CompilerConstants.IntegerNotSet; | 234 | var language = CompilerConstants.IntegerNotSet; |
231 | string hxi = null; | 235 | string hxi = null; |
232 | string hxq = null; | 236 | string hxq = null; |
233 | string hxr = null; | 237 | string hxr = null; |
234 | string samples = null; | 238 | string samples = null; |
235 | YesNoType suppressCAs = YesNoType.No; | 239 | var suppressCAs = YesNoType.No; |
236 | 240 | ||
237 | foreach (XAttribute attrib in element.Attributes()) | 241 | foreach (var attrib in element.Attributes()) |
238 | { | 242 | { |
239 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 243 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
240 | { | 244 | { |
@@ -245,11 +249,11 @@ namespace WixToolset.VisualStudio | |||
245 | break; | 249 | break; |
246 | case "AttributeIndex": | 250 | case "AttributeIndex": |
247 | hxr = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 251 | hxr = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
248 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", hxr); | 252 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, hxr); |
249 | break; | 253 | break; |
250 | case "Index": | 254 | case "Index": |
251 | hxi = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 255 | hxi = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
252 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", hxi); | 256 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, hxi); |
253 | break; | 257 | break; |
254 | case "Language": | 258 | case "Language": |
255 | language = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); | 259 | language = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); |
@@ -259,11 +263,11 @@ namespace WixToolset.VisualStudio | |||
259 | break; | 263 | break; |
260 | case "SampleLocation": | 264 | case "SampleLocation": |
261 | samples = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 265 | samples = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
262 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", samples); | 266 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, samples); |
263 | break; | 267 | break; |
264 | case "Search": | 268 | case "Search": |
265 | hxq = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 269 | hxq = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
266 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", hxq); | 270 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, hxq); |
267 | break; | 271 | break; |
268 | case "SuppressCustomActions": | 272 | case "SuppressCustomActions": |
269 | suppressCAs = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 273 | suppressCAs = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
@@ -281,7 +285,7 @@ namespace WixToolset.VisualStudio | |||
281 | 285 | ||
282 | if (null == id) | 286 | if (null == id) |
283 | { | 287 | { |
284 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); | 288 | id = this.ParseHelper.CreateIdentifier("vshf", fileId, name, language.ToString(CultureInfo.InvariantCulture.NumberFormat)); |
285 | } | 289 | } |
286 | 290 | ||
287 | if (null == name) | 291 | if (null == name) |
@@ -299,28 +303,30 @@ namespace WixToolset.VisualStudio | |||
299 | 303 | ||
300 | if (!this.Messaging.EncounteredError) | 304 | if (!this.Messaging.EncounteredError) |
301 | { | 305 | { |
302 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpFile", id); | 306 | section.AddTuple(new HelpFileTuple(sourceLineNumbers, id) |
303 | row.Set(1, name); | 307 | { |
304 | row.Set(2, language); | 308 | HelpFileName = name, |
305 | row.Set(3, fileId); | 309 | LangID = language, |
306 | row.Set(4, hxi); | 310 | HxSFileRef = fileId, |
307 | row.Set(5, hxq); | 311 | HxIFileRef = hxi, |
308 | row.Set(6, hxr); | 312 | HxQFileRef = hxq, |
309 | row.Set(7, samples); | 313 | HxRFileRef = hxr, |
314 | SamplesFileRef = samples, | ||
315 | }); | ||
310 | 316 | ||
311 | if (YesNoType.No == suppressCAs) | 317 | if (YesNoType.No == suppressCAs) |
312 | { | 318 | { |
313 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "CA_RegisterMicrosoftHelp.3643236F_FC70_11D3_A536_0090278A1BB8"); | 319 | this.AddReferenceToRegisterMicrosoftHelp(section, sourceLineNumbers); |
314 | } | 320 | } |
315 | } | 321 | } |
316 | } | 322 | } |
317 | 323 | ||
318 | private void ParseHelpFileRefElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier collectionId) | 324 | private void ParseHelpFileRefElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier collectionId) |
319 | { | 325 | { |
320 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 326 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
321 | Identifier id = null; | 327 | Identifier id = null; |
322 | 328 | ||
323 | foreach (XAttribute attrib in element.Attributes()) | 329 | foreach (var attrib in element.Attributes()) |
324 | { | 330 | { |
325 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 331 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
326 | { | 332 | { |
@@ -328,7 +334,7 @@ namespace WixToolset.VisualStudio | |||
328 | { | 334 | { |
329 | case "Id": | 335 | case "Id": |
330 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); | 336 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
331 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "HelpFile", id.Id); | 337 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, VSTupleDefinitions.HelpFile, id.Id); |
332 | break; | 338 | break; |
333 | default: | 339 | default: |
334 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 340 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
@@ -350,20 +356,23 @@ namespace WixToolset.VisualStudio | |||
350 | 356 | ||
351 | if (!this.Messaging.EncounteredError) | 357 | if (!this.Messaging.EncounteredError) |
352 | { | 358 | { |
353 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpFileToNamespace", id); | 359 | section.AddTuple(new HelpFileToNamespaceTuple(sourceLineNumbers, id) |
354 | row.Set(1, collectionId.Id); | 360 | { |
361 | HelpFileRef = id.Id, | ||
362 | HelpNamespaceRef = collectionId.Id, | ||
363 | }); | ||
355 | } | 364 | } |
356 | } | 365 | } |
357 | 366 | ||
358 | private void ParseHelpFilterElement(Intermediate intermediate, IntermediateSection section, XElement element) | 367 | private void ParseHelpFilterElement(Intermediate intermediate, IntermediateSection section, XElement element) |
359 | { | 368 | { |
360 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 369 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
361 | Identifier id = null; | 370 | Identifier id = null; |
362 | string filterDefinition = null; | 371 | string filterDefinition = null; |
363 | string name = null; | 372 | string name = null; |
364 | YesNoType suppressCAs = YesNoType.No; | 373 | var suppressCAs = YesNoType.No; |
365 | 374 | ||
366 | foreach (XAttribute attrib in element.Attributes()) | 375 | foreach (var attrib in element.Attributes()) |
367 | { | 376 | { |
368 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 377 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
369 | { | 378 | { |
@@ -394,7 +403,7 @@ namespace WixToolset.VisualStudio | |||
394 | 403 | ||
395 | if (null == id) | 404 | if (null == id) |
396 | { | 405 | { |
397 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); | 406 | id = this.ParseHelper.CreateIdentifier("hfl", name, filterDefinition); |
398 | } | 407 | } |
399 | 408 | ||
400 | if (null == name) | 409 | if (null == name) |
@@ -406,23 +415,25 @@ namespace WixToolset.VisualStudio | |||
406 | 415 | ||
407 | if (!this.Messaging.EncounteredError) | 416 | if (!this.Messaging.EncounteredError) |
408 | { | 417 | { |
409 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpFilter", id); | 418 | section.AddTuple(new HelpFilterTuple(sourceLineNumbers, id) |
410 | row.Set(1, name); | 419 | { |
411 | row.Set(2, filterDefinition); | 420 | Description = name, |
421 | QueryString = filterDefinition, | ||
422 | }); | ||
412 | 423 | ||
413 | if (YesNoType.No == suppressCAs) | 424 | if (YesNoType.No == suppressCAs) |
414 | { | 425 | { |
415 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "CA_RegisterMicrosoftHelp.3643236F_FC70_11D3_A536_0090278A1BB8"); | 426 | this.AddReferenceToRegisterMicrosoftHelp(section, sourceLineNumbers); |
416 | } | 427 | } |
417 | } | 428 | } |
418 | } | 429 | } |
419 | 430 | ||
420 | private void ParseHelpFilterRefElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier collectionId) | 431 | private void ParseHelpFilterRefElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier collectionId) |
421 | { | 432 | { |
422 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 433 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
423 | Identifier id = null; | 434 | Identifier id = null; |
424 | 435 | ||
425 | foreach (XAttribute attrib in element.Attributes()) | 436 | foreach (var attrib in element.Attributes()) |
426 | { | 437 | { |
427 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 438 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
428 | { | 439 | { |
@@ -430,7 +441,7 @@ namespace WixToolset.VisualStudio | |||
430 | { | 441 | { |
431 | case "Id": | 442 | case "Id": |
432 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); | 443 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
433 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "HelpFilter", id.Id); | 444 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, VSTupleDefinitions.HelpFilter, id.Id); |
434 | break; | 445 | break; |
435 | default: | 446 | default: |
436 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 447 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
@@ -452,24 +463,25 @@ namespace WixToolset.VisualStudio | |||
452 | 463 | ||
453 | if (!this.Messaging.EncounteredError) | 464 | if (!this.Messaging.EncounteredError) |
454 | { | 465 | { |
455 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpFilterToNamespace", id); | 466 | section.AddTuple(new HelpFilterToNamespaceTuple(sourceLineNumbers, id) |
456 | row.Set(1, collectionId.Id); | 467 | { |
468 | HelpFilterRef = id.Id, | ||
469 | HelpNamespaceRef = collectionId.Id, | ||
470 | }); | ||
457 | } | 471 | } |
458 | } | 472 | } |
459 | 473 | ||
460 | private void ParsePlugCollectionIntoElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier parentId) | 474 | private void ParsePlugCollectionIntoElement(Intermediate intermediate, IntermediateSection section, XElement element, Identifier parentId) |
461 | { | 475 | { |
462 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 476 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
463 | string hxa = null; | 477 | string hxa = null; |
464 | string hxt = null; | 478 | string hxt = null; |
465 | string hxtParent = null; | 479 | string hxtParent = null; |
466 | string namespaceParent = null; | 480 | string namespaceParent = null; |
467 | string feature = null; | 481 | string feature = null; |
468 | YesNoType suppressExternalNamespaces = YesNoType.No; | 482 | var suppressExternalNamespaces = YesNoType.No; |
469 | bool pluginVS05 = false; | ||
470 | bool pluginVS08 = false; | ||
471 | 483 | ||
472 | foreach (XAttribute attrib in element.Attributes()) | 484 | foreach (var attrib in element.Attributes()) |
473 | { | 485 | { |
474 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 486 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
475 | { | 487 | { |
@@ -504,8 +516,8 @@ namespace WixToolset.VisualStudio | |||
504 | } | 516 | } |
505 | } | 517 | } |
506 | 518 | ||
507 | pluginVS05 = namespaceParent.Equals("MS_VSIPCC_v80", StringComparison.Ordinal); | 519 | var pluginVS05 = namespaceParent.Equals("MS_VSIPCC_v80", StringComparison.Ordinal); |
508 | pluginVS08 = namespaceParent.Equals("MS.VSIPCC.v90", StringComparison.Ordinal); | 520 | var pluginVS08 = namespaceParent.Equals("MS.VSIPCC.v90", StringComparison.Ordinal); |
509 | 521 | ||
510 | if (null == namespaceParent) | 522 | if (null == namespaceParent) |
511 | { | 523 | { |
@@ -521,11 +533,14 @@ namespace WixToolset.VisualStudio | |||
521 | 533 | ||
522 | if (!this.Messaging.EncounteredError) | 534 | if (!this.Messaging.EncounteredError) |
523 | { | 535 | { |
524 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "HelpPlugin", parentId); | 536 | section.AddTuple(new HelpPluginTuple(sourceLineNumbers, parentId) |
525 | row.Set(1, namespaceParent); | 537 | { |
526 | row.Set(2, hxt); | 538 | HelpNamespaceRef = parentId.Id, |
527 | row.Set(3, hxa); | 539 | ParentHelpNamespaceRef = namespaceParent, |
528 | row.Set(4, hxtParent); | 540 | HxTFileRef = hxt, |
541 | HxAFileRef = hxa, | ||
542 | ParentHxTFileRef = hxtParent, | ||
543 | }); | ||
529 | 544 | ||
530 | if (pluginVS05) | 545 | if (pluginVS05) |
531 | { | 546 | { |
@@ -535,7 +550,7 @@ namespace WixToolset.VisualStudio | |||
535 | this.ParseHelper.CreateComplexReference(section, sourceLineNumbers, ComplexReferenceParentType.Feature, feature, String.Empty, | 550 | this.ParseHelper.CreateComplexReference(section, sourceLineNumbers, ComplexReferenceParentType.Feature, feature, String.Empty, |
536 | ComplexReferenceChildType.ComponentGroup, "Help2_VS2005_Namespace_Components", false); | 551 | ComplexReferenceChildType.ComponentGroup, "Help2_VS2005_Namespace_Components", false); |
537 | // Reference CustomAction since nothing will happen without it | 552 | // Reference CustomAction since nothing will happen without it |
538 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "CA_HxMerge_VSIPCC_VSCC"); | 553 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "CA_HxMerge_VSIPCC_VSCC"); |
539 | } | 554 | } |
540 | } | 555 | } |
541 | else if (pluginVS08) | 556 | else if (pluginVS08) |
@@ -546,28 +561,28 @@ namespace WixToolset.VisualStudio | |||
546 | this.ParseHelper.CreateComplexReference(section, sourceLineNumbers, ComplexReferenceParentType.Feature, feature, String.Empty, | 561 | this.ParseHelper.CreateComplexReference(section, sourceLineNumbers, ComplexReferenceParentType.Feature, feature, String.Empty, |
547 | ComplexReferenceChildType.ComponentGroup, "Help2_VS2008_Namespace_Components", false); | 562 | ComplexReferenceChildType.ComponentGroup, "Help2_VS2008_Namespace_Components", false); |
548 | // Reference CustomAction since nothing will happen without it | 563 | // Reference CustomAction since nothing will happen without it |
549 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "CA_ScheduleExtHelpPlugin_VSCC_VSIPCC"); | 564 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "CA_ScheduleExtHelpPlugin_VSCC_VSIPCC"); |
550 | } | 565 | } |
551 | } | 566 | } |
552 | else | 567 | else |
553 | { | 568 | { |
554 | // Reference the parent namespace to enforce the foreign key relationship | 569 | // Reference the parent namespace to enforce the foreign key relationship |
555 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "HelpNamespace", namespaceParent); | 570 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, VSTupleDefinitions.HelpNamespace, namespaceParent); |
556 | } | 571 | } |
557 | } | 572 | } |
558 | } | 573 | } |
559 | 574 | ||
560 | private void ParseVsixPackageElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string fileId) | 575 | private void ParseVsixPackageElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string fileId) |
561 | { | 576 | { |
562 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 577 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
563 | string propertyId = "VS_VSIX_INSTALLER_PATH"; | 578 | var propertyId = "VS_VSIX_INSTALLER_PATH"; |
564 | string packageId = null; | 579 | string packageId = null; |
565 | YesNoType permanent = YesNoType.NotSet; | 580 | var permanent = YesNoType.NotSet; |
566 | string target = null; | 581 | string target = null; |
567 | string targetVersion = null; | 582 | string targetVersion = null; |
568 | YesNoType vital = YesNoType.NotSet; | 583 | var vital = YesNoType.NotSet; |
569 | 584 | ||
570 | foreach (XAttribute attrib in element.Attributes()) | 585 | foreach (var attrib in element.Attributes()) |
571 | { | 586 | { |
572 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 587 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
573 | { | 588 | { |
@@ -664,98 +679,131 @@ namespace WixToolset.VisualStudio | |||
664 | if (!this.Messaging.EncounteredError) | 679 | if (!this.Messaging.EncounteredError) |
665 | { | 680 | { |
666 | // Ensure there is a reference to the AppSearch Property that will find the VsixInstaller.exe. | 681 | // Ensure there is a reference to the AppSearch Property that will find the VsixInstaller.exe. |
667 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Property", propertyId); | 682 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Property, propertyId); |
668 | 683 | ||
669 | // Ensure there is a reference to the package file (even if we are a child under it). | 684 | // Ensure there is a reference to the package file (even if we are a child under it). |
670 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "File", fileId); | 685 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.File, fileId); |
671 | 686 | ||
672 | string cmdlinePrefix = "/q "; | 687 | var cmdlinePrefix = "/q "; |
673 | 688 | ||
674 | if (!String.IsNullOrEmpty(target)) | 689 | if (!String.IsNullOrEmpty(target)) |
675 | { | 690 | { |
676 | cmdlinePrefix = String.Format("{0} /skuName:{1} /skuVersion:{2}", cmdlinePrefix, target, targetVersion); | 691 | cmdlinePrefix = String.Format("{0} /skuName:{1} /skuVersion:{2}", cmdlinePrefix, target, targetVersion); |
677 | } | 692 | } |
678 | 693 | ||
679 | string installAfter = "WriteRegistryValues"; // by default, come after the registry key registration. | 694 | var installAfter = "WriteRegistryValues"; // by default, come after the registry key registration. |
680 | int installExtraBits = VSCompiler.MsidbCustomActionTypeInScript; | 695 | |
696 | var installNamePerUser = this.ParseHelper.CreateIdentifier("viu", componentId, fileId, "per-user", target, targetVersion); | ||
697 | var installNamePerMachine = this.ParseHelper.CreateIdentifier("vim", componentId, fileId, "per-machine", target, targetVersion); | ||
698 | var installCmdLinePerUser = String.Format("{0} \"[#{1}]\"", cmdlinePrefix, fileId); | ||
699 | var installCmdLinePerMachine = String.Concat(installCmdLinePerUser, " /admin"); | ||
700 | var installConditionPerUser = String.Format("NOT ALLUSERS AND ${0}=3", componentId); // only execute if the Component being installed. | ||
701 | var installConditionPerMachine = String.Format("ALLUSERS AND ${0}=3", componentId); // only execute if the Component being installed. | ||
702 | var installPerUserCA = new CustomActionTuple(sourceLineNumbers, installNamePerUser) | ||
703 | { | ||
704 | ExecutionType = CustomActionExecutionType.Deferred, | ||
705 | Impersonate = true, | ||
706 | }; | ||
707 | var installPerMachineCA = new CustomActionTuple(sourceLineNumbers, installNamePerMachine) | ||
708 | { | ||
709 | ExecutionType = CustomActionExecutionType.Deferred, | ||
710 | Impersonate = false, | ||
711 | }; | ||
681 | 712 | ||
682 | // If the package is not vital, mark the install action as continue. | 713 | // If the package is not vital, mark the install action as continue. |
683 | if (vital == YesNoType.No) | 714 | if (vital == YesNoType.No) |
684 | { | 715 | { |
685 | installExtraBits |= VSCompiler.MsidbCustomActionTypeContinue; | 716 | installPerUserCA.IgnoreResult = true; |
717 | installPerMachineCA.IgnoreResult = true; | ||
686 | } | 718 | } |
687 | else // the package is vital so ensure there is a rollback action scheduled. | 719 | else // the package is vital so ensure there is a rollback action scheduled. |
688 | { | 720 | { |
689 | Identifier rollbackNamePerUser = this.ParseHelper.CreateIdentifier("vru", componentId, fileId, "per-user", target ?? String.Empty, targetVersion ?? String.Empty); | 721 | var rollbackNamePerUser = this.ParseHelper.CreateIdentifier("vru", componentId, fileId, "per-user", target, targetVersion); |
690 | Identifier rollbackNamePerMachine = this.ParseHelper.CreateIdentifier("vrm", componentId, fileId, "per-machine", target ?? String.Empty, targetVersion ?? String.Empty); | 722 | var rollbackNamePerMachine = this.ParseHelper.CreateIdentifier("vrm", componentId, fileId, "per-machine", target, targetVersion); |
691 | string rollbackCmdLinePerUser = String.Concat(cmdlinePrefix, " /u:\"", packageId, "\""); | 723 | var rollbackCmdLinePerUser = String.Concat(cmdlinePrefix, " /u:\"", packageId, "\""); |
692 | string rollbackCmdLinePerMachine = String.Concat(rollbackCmdLinePerUser, " /admin"); | 724 | var rollbackCmdLinePerMachine = String.Concat(rollbackCmdLinePerUser, " /admin"); |
693 | int rollbackExtraBitsPerUser = VSCompiler.MsidbCustomActionTypeContinue | VSCompiler.MsidbCustomActionTypeRollback | VSCompiler.MsidbCustomActionTypeInScript; | 725 | var rollbackConditionPerUser = String.Format("NOT ALLUSERS AND NOT Installed AND ${0}=2 AND ?{0}>2", componentId); // NOT Installed && Component being installed but not installed already. |
694 | int rollbackExtraBitsPerMachine = rollbackExtraBitsPerUser | VSCompiler.MsidbCustomActionTypeNoImpersonate; | 726 | var rollbackConditionPerMachine = String.Format("ALLUSERS AND NOT Installed AND ${0}=2 AND ?{0}>2", componentId); // NOT Installed && Component being installed but not installed already. |
695 | string rollbackConditionPerUser = String.Format("NOT ALLUSERS AND NOT Installed AND ${0}=2 AND ?{0}>2", componentId); // NOT Installed && Component being installed but not installed already. | 727 | var rollbackPerUserCA = new CustomActionTuple(sourceLineNumbers, rollbackNamePerUser) |
696 | string rollbackConditionPerMachine = String.Format("ALLUSERS AND NOT Installed AND ${0}=2 AND ?{0}>2", componentId); // NOT Installed && Component being installed but not installed already. | 728 | { |
729 | ExecutionType = CustomActionExecutionType.Rollback, | ||
730 | IgnoreResult = true, | ||
731 | Impersonate = true, | ||
732 | }; | ||
733 | var rollbackPerMachineCA = new CustomActionTuple(sourceLineNumbers, rollbackNamePerMachine) | ||
734 | { | ||
735 | ExecutionType = CustomActionExecutionType.Rollback, | ||
736 | IgnoreResult = true, | ||
737 | Impersonate = false, | ||
738 | }; | ||
697 | 739 | ||
698 | this.SchedulePropertyExeAction(section, sourceLineNumbers, rollbackNamePerUser, propertyId, rollbackCmdLinePerUser, rollbackExtraBitsPerUser, rollbackConditionPerUser, null, installAfter); | 740 | this.SchedulePropertyExeAction(section, sourceLineNumbers, rollbackNamePerUser, propertyId, rollbackCmdLinePerUser, rollbackPerUserCA, rollbackConditionPerUser, null, installAfter); |
699 | this.SchedulePropertyExeAction(section, sourceLineNumbers, rollbackNamePerMachine, propertyId, rollbackCmdLinePerMachine, rollbackExtraBitsPerMachine, rollbackConditionPerMachine, null, rollbackNamePerUser.Id); | 741 | this.SchedulePropertyExeAction(section, sourceLineNumbers, rollbackNamePerMachine, propertyId, rollbackCmdLinePerMachine, rollbackPerMachineCA, rollbackConditionPerMachine, null, rollbackNamePerUser.Id); |
700 | 742 | ||
701 | installAfter = rollbackNamePerMachine.Id; | 743 | installAfter = rollbackNamePerMachine.Id; |
702 | } | 744 | } |
703 | 745 | ||
704 | Identifier installNamePerUser = this.ParseHelper.CreateIdentifier("viu", componentId, fileId, "per-user", target ?? String.Empty, targetVersion ?? String.Empty); | 746 | this.SchedulePropertyExeAction(section, sourceLineNumbers, installNamePerUser, propertyId, installCmdLinePerUser, installPerUserCA, installConditionPerUser, null, installAfter); |
705 | Identifier installNamePerMachine = this.ParseHelper.CreateIdentifier("vim", componentId, fileId, "per-machine", target ?? String.Empty, targetVersion ?? String.Empty); | 747 | this.SchedulePropertyExeAction(section, sourceLineNumbers, installNamePerMachine, propertyId, installCmdLinePerMachine, installPerMachineCA, installConditionPerMachine, null, installNamePerUser.Id); |
706 | string installCmdLinePerUser = String.Format("{0} \"[#{1}]\"", cmdlinePrefix, fileId); | ||
707 | string installCmdLinePerMachine = String.Concat(installCmdLinePerUser, " /admin"); | ||
708 | string installConditionPerUser = String.Format("NOT ALLUSERS AND ${0}=3", componentId); // only execute if the Component being installed. | ||
709 | string installConditionPerMachine = String.Format("ALLUSERS AND ${0}=3", componentId); // only execute if the Component being installed. | ||
710 | |||
711 | this.SchedulePropertyExeAction(section, sourceLineNumbers, installNamePerUser, propertyId, installCmdLinePerUser, installExtraBits, installConditionPerUser, null, installAfter); | ||
712 | this.SchedulePropertyExeAction(section, sourceLineNumbers, installNamePerMachine, propertyId, installCmdLinePerMachine, installExtraBits | VSCompiler.MsidbCustomActionTypeNoImpersonate, installConditionPerMachine, null, installNamePerUser.Id); | ||
713 | 748 | ||
714 | // If not permanent, schedule the uninstall custom action. | 749 | // If not permanent, schedule the uninstall custom action. |
715 | if (permanent != YesNoType.Yes) | 750 | if (permanent != YesNoType.Yes) |
716 | { | 751 | { |
717 | Identifier uninstallNamePerUser = this.ParseHelper.CreateIdentifier("vuu", componentId, fileId, "per-user", target ?? String.Empty, targetVersion ?? String.Empty); | 752 | var uninstallNamePerUser = this.ParseHelper.CreateIdentifier("vuu", componentId, fileId, "per-user", target ?? String.Empty, targetVersion ?? String.Empty); |
718 | Identifier uninstallNamePerMachine = this.ParseHelper.CreateIdentifier("vum", componentId, fileId, "per-machine", target ?? String.Empty, targetVersion ?? String.Empty); | 753 | var uninstallNamePerMachine = this.ParseHelper.CreateIdentifier("vum", componentId, fileId, "per-machine", target ?? String.Empty, targetVersion ?? String.Empty); |
719 | string uninstallCmdLinePerUser = String.Concat(cmdlinePrefix, " /u:\"", packageId, "\""); | 754 | var uninstallCmdLinePerUser = String.Concat(cmdlinePrefix, " /u:\"", packageId, "\""); |
720 | string uninstallCmdLinePerMachine = String.Concat(uninstallCmdLinePerUser, " /admin"); | 755 | var uninstallCmdLinePerMachine = String.Concat(uninstallCmdLinePerUser, " /admin"); |
721 | int uninstallExtraBitsPerUser = VSCompiler.MsidbCustomActionTypeContinue | VSCompiler.MsidbCustomActionTypeInScript; | 756 | var uninstallConditionPerUser = String.Format("NOT ALLUSERS AND ${0}=2 AND ?{0}>2", componentId); // Only execute if component is being uninstalled. |
722 | int uninstallExtraBitsPerMachine = uninstallExtraBitsPerUser | VSCompiler.MsidbCustomActionTypeNoImpersonate; | 757 | var uninstallConditionPerMachine = String.Format("ALLUSERS AND ${0}=2 AND ?{0}>2", componentId); // Only execute if component is being uninstalled. |
723 | string uninstallConditionPerUser = String.Format("NOT ALLUSERS AND ${0}=2 AND ?{0}>2", componentId); // Only execute if component is being uninstalled. | 758 | var uninstallPerUserCA = new CustomActionTuple(sourceLineNumbers, uninstallNamePerUser) |
724 | string uninstallConditionPerMachine = String.Format("ALLUSERS AND ${0}=2 AND ?{0}>2", componentId); // Only execute if component is being uninstalled. | 759 | { |
760 | ExecutionType = CustomActionExecutionType.Deferred, | ||
761 | IgnoreResult = true, | ||
762 | Impersonate = true, | ||
763 | }; | ||
764 | var uninstallPerMachineCA = new CustomActionTuple(sourceLineNumbers, uninstallNamePerMachine) | ||
765 | { | ||
766 | ExecutionType = CustomActionExecutionType.Deferred, | ||
767 | IgnoreResult = true, | ||
768 | Impersonate = false, | ||
769 | }; | ||
725 | 770 | ||
726 | this.SchedulePropertyExeAction(section, sourceLineNumbers, uninstallNamePerUser, propertyId, uninstallCmdLinePerUser, uninstallExtraBitsPerUser, uninstallConditionPerUser, "InstallFinalize", null); | 771 | this.SchedulePropertyExeAction(section, sourceLineNumbers, uninstallNamePerUser, propertyId, uninstallCmdLinePerUser, uninstallPerUserCA, uninstallConditionPerUser, "InstallFinalize", null); |
727 | this.SchedulePropertyExeAction(section, sourceLineNumbers, uninstallNamePerMachine, propertyId, uninstallCmdLinePerMachine, uninstallExtraBitsPerMachine, uninstallConditionPerMachine, "InstallFinalize", null); | 772 | this.SchedulePropertyExeAction(section, sourceLineNumbers, uninstallNamePerMachine, propertyId, uninstallCmdLinePerMachine, uninstallPerMachineCA, uninstallConditionPerMachine, "InstallFinalize", null); |
728 | } | 773 | } |
729 | } | 774 | } |
730 | } | 775 | } |
731 | 776 | ||
732 | private void SchedulePropertyExeAction(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier name, string source, string cmdline, int extraBits, string condition, string beforeAction, string afterAction) | 777 | private void SchedulePropertyExeAction(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier name, string source, string cmdline, CustomActionTuple caTemplate, string condition, string beforeAction, string afterAction) |
733 | { | 778 | { |
734 | const string sequence = "InstallExecuteSequence"; | 779 | const SequenceTable sequence = SequenceTable.InstallExecuteSequence; |
735 | 780 | ||
736 | var actionRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "CustomAction", name); | 781 | caTemplate.SourceType = CustomActionSourceType.Property; |
737 | actionRow.Set(1, VSCompiler.MsidbCustomActionTypeProperty | VSCompiler.MsidbCustomActionTypeExe | extraBits); | 782 | caTemplate.Source = source; |
738 | actionRow.Set(2, source); | 783 | caTemplate.TargetType = CustomActionTargetType.Exe; |
739 | actionRow.Set(3, cmdline); | 784 | caTemplate.Target = cmdline; |
740 | 785 | section.AddTuple(caTemplate); | |
741 | var sequenceRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixAction", new Identifier(name.Access, sequence, name.Id)); | 786 | |
742 | sequenceRow.Set(0, sequence); | 787 | section.AddTuple(new WixActionTuple(sourceLineNumbers, new Identifier(name.Access, sequence, name.Id)) |
743 | sequenceRow.Set(1, name.Id); | 788 | { |
744 | sequenceRow.Set(2, condition); | 789 | SequenceTable = SequenceTable.InstallExecuteSequence, |
745 | // no explicit sequence | 790 | Action = name.Id, |
746 | sequenceRow.Set(4, beforeAction); | 791 | Condition = condition, |
747 | sequenceRow.Set(5, afterAction); | 792 | // no explicit sequence |
748 | sequenceRow.Set(6, 0); // not overridable | 793 | Before = beforeAction, |
794 | After = afterAction, | ||
795 | Overridable = false, | ||
796 | }); | ||
749 | 797 | ||
750 | if (null != beforeAction) | 798 | if (null != beforeAction) |
751 | { | 799 | { |
752 | if (WindowsInstallerStandard.IsStandardAction(beforeAction)) | 800 | if (WindowsInstallerStandard.IsStandardAction(beforeAction)) |
753 | { | 801 | { |
754 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixAction", sequence, beforeAction); | 802 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), beforeAction); |
755 | } | 803 | } |
756 | else | 804 | else |
757 | { | 805 | { |
758 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", beforeAction); | 806 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, beforeAction); |
759 | } | 807 | } |
760 | } | 808 | } |
761 | 809 | ||
@@ -763,13 +811,18 @@ namespace WixToolset.VisualStudio | |||
763 | { | 811 | { |
764 | if (WindowsInstallerStandard.IsStandardAction(afterAction)) | 812 | if (WindowsInstallerStandard.IsStandardAction(afterAction)) |
765 | { | 813 | { |
766 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixAction", sequence, afterAction); | 814 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), afterAction); |
767 | } | 815 | } |
768 | else | 816 | else |
769 | { | 817 | { |
770 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", afterAction); | 818 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, afterAction); |
771 | } | 819 | } |
772 | } | 820 | } |
773 | } | 821 | } |
822 | |||
823 | private void AddReferenceToRegisterMicrosoftHelp(IntermediateSection section, SourceLineNumber sourceLineNumbers) | ||
824 | { | ||
825 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "CA_RegisterMicrosoftHelp.3643236F_FC70_11D3_A536_0090278A1BB8"); | ||
826 | } | ||
774 | } | 827 | } |
775 | } | 828 | } |