diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-04-10 15:04:04 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-12 10:24:01 -0700 |
| commit | 3441afb46c4dc056493ab84f9b27434c4185d713 (patch) | |
| tree | ec5d6b43292d34e256ebcbf6bf8795b4da46bc80 /src/WixToolset.Core/Compiler.cs | |
| parent | e7b745b08c51b173c80253432a82583e73c46157 (diff) | |
| download | wix-3441afb46c4dc056493ab84f9b27434c4185d713.tar.gz wix-3441afb46c4dc056493ab84f9b27434c4185d713.tar.bz2 wix-3441afb46c4dc056493ab84f9b27434c4185d713.zip | |
Improve implicit Component/@Id generation and duplicate GUID errors
Diffstat (limited to 'src/WixToolset.Core/Compiler.cs')
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index c5f3a763..c39bec70 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -2454,24 +2454,27 @@ namespace WixToolset.Core | |||
| 2454 | } | 2454 | } |
| 2455 | } | 2455 | } |
| 2456 | 2456 | ||
| 2457 | // check for conditions that exclude this component from using generated guids | 2457 | // Check for conditions that exclude this component from using implicit ids and/or generated guids. |
| 2458 | var isGeneratableGuidOk = "*" == guid; | 2458 | var allowImplicitIds = true; |
| 2459 | if (isGeneratableGuidOk) | 2459 | if (encounteredODBCDataSource || ComponentKeyPathType.Directory == keyPathType) |
| 2460 | { | 2460 | { |
| 2461 | if (encounteredODBCDataSource || ComponentKeyPathType.Directory == keyPathType) | 2461 | allowImplicitIds = false; |
| 2462 | if (guid == "*") | ||
| 2462 | { | 2463 | { |
| 2463 | this.Core.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers)); | 2464 | this.Core.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers)); |
| 2464 | isGeneratableGuidOk = false; | ||
| 2465 | } | 2465 | } |
| 2466 | else if (0 < files && ComponentKeyPathType.Registry == keyPathType) | 2466 | } |
| 2467 | else if (0 < files && ComponentKeyPathType.Registry == keyPathType) | ||
| 2468 | { | ||
| 2469 | allowImplicitIds = false; | ||
| 2470 | if (guid == "*") | ||
| 2467 | { | 2471 | { |
| 2468 | this.Core.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers, true)); | 2472 | this.Core.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(sourceLineNumbers, true)); |
| 2469 | isGeneratableGuidOk = false; | ||
| 2470 | } | 2473 | } |
| 2471 | } | 2474 | } |
| 2472 | 2475 | ||
| 2473 | // check for implicit KeyPath which can easily be accidentally changed | 2476 | // Check for implicit KeyPath which can easily be accidentally changed |
| 2474 | if (this.ShowPedanticMessages && !keyFound && !isGeneratableGuidOk) | 2477 | if (this.ShowPedanticMessages && !keyFound && !allowImplicitIds) |
| 2475 | { | 2478 | { |
| 2476 | this.Core.Write(ErrorMessages.ImplicitComponentKeyPath(sourceLineNumbers, id.Id)); | 2479 | this.Core.Write(ErrorMessages.ImplicitComponentKeyPath(sourceLineNumbers, id.Id)); |
| 2477 | } | 2480 | } |
| @@ -2481,7 +2484,7 @@ namespace WixToolset.Core | |||
| 2481 | // generatable guid must be met. | 2484 | // generatable guid must be met. |
| 2482 | if (componentIdPlaceholder == id.Id) | 2485 | if (componentIdPlaceholder == id.Id) |
| 2483 | { | 2486 | { |
| 2484 | if (isGeneratableGuidOk || keyFound && !String.IsNullOrEmpty(keyPath)) | 2487 | if (allowImplicitIds || keyFound && !String.IsNullOrEmpty(keyPath)) |
| 2485 | { | 2488 | { |
| 2486 | this.componentIdPlaceholders.Add(componentIdPlaceholder, keyPath); | 2489 | this.componentIdPlaceholders.Add(componentIdPlaceholder, keyPath); |
| 2487 | 2490 | ||
