diff options
author | Bob Arnson <bob@firegiant.com> | 2023-12-30 22:53:21 -0500 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-12-30 23:35:38 -0500 |
commit | c890f0e1a360d949d5e0b5d9ab619c4a78d9fbd3 (patch) | |
tree | 6eac4e52b746c9aa5ee3fe8bfaa4019ba8f4abd9 | |
parent | 1eea9c6e7b276c7c0dfde7779dfec45046ad5831 (diff) | |
download | wix-c890f0e1a360d949d5e0b5d9ab619c4a78d9fbd3.tar.gz wix-c890f0e1a360d949d5e0b5d9ab619c4a78d9fbd3.tar.bz2 wix-c890f0e1a360d949d5e0b5d9ab619c4a78d9fbd3.zip |
Add a warning that VBScript is deprecated.
4 files changed, 66 insertions, 0 deletions
diff --git a/src/api/wix/WixToolset.Data/WarningMessages.cs b/src/api/wix/WixToolset.Data/WarningMessages.cs index 790291e4..f3d469bf 100644 --- a/src/api/wix/WixToolset.Data/WarningMessages.cs +++ b/src/api/wix/WixToolset.Data/WarningMessages.cs | |||
@@ -714,6 +714,11 @@ namespace WixToolset.Data | |||
714 | return Message(sourceLineNumbers, Ids.InvalidWixVersion, "Invalid WixVersion '{0}' in {1}/@'{2}'. Comparisons may yield unexpected results.", version, elementName, attributeName); | 714 | return Message(sourceLineNumbers, Ids.InvalidWixVersion, "Invalid WixVersion '{0}' in {1}/@'{2}'. Comparisons may yield unexpected results.", version, elementName, attributeName); |
715 | } | 715 | } |
716 | 716 | ||
717 | public static Message VBScriptIsDeprecated(SourceLineNumber sourceLineNumbers) | ||
718 | { | ||
719 | return Message(sourceLineNumbers, Ids.VBScriptIsDeprecated, "VBScript is a deprecated Windows component: https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features. VBScript custom actions might fail on some Windows systems. Rewrite or eliminate VBScript custom actions for best compatibility."); | ||
720 | } | ||
721 | |||
717 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | 722 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
718 | { | 723 | { |
719 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); | 724 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); |
@@ -855,6 +860,7 @@ namespace WixToolset.Data | |||
855 | DiscardedRollbackBoundary2 = 1160, | 860 | DiscardedRollbackBoundary2 = 1160, |
856 | ExePackageDetectInformationRecommended = 1161, | 861 | ExePackageDetectInformationRecommended = 1161, |
857 | InvalidWixVersion = 1162, | 862 | InvalidWixVersion = 1162, |
863 | VBScriptIsDeprecated = 1163, | ||
858 | } | 864 | } |
859 | } | 865 | } |
860 | } | 866 | } |
diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index bfdf4fe8..7088cfba 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs | |||
@@ -3447,6 +3447,11 @@ namespace WixToolset.Core | |||
3447 | } | 3447 | } |
3448 | } | 3448 | } |
3449 | 3449 | ||
3450 | if (targetType == CustomActionTargetType.VBScript) | ||
3451 | { | ||
3452 | this.Core.Write(WarningMessages.VBScriptIsDeprecated(sourceLineNumbers)); | ||
3453 | } | ||
3454 | |||
3450 | // if we have an in-lined Script CustomAction ensure no source or target attributes were provided | 3455 | // if we have an in-lined Script CustomAction ensure no source or target attributes were provided |
3451 | if (inlineScript) | 3456 | if (inlineScript) |
3452 | { | 3457 | { |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs index 091b7d53..bb833328 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs | |||
@@ -98,6 +98,34 @@ namespace WixToolsetTest.CoreIntegration | |||
98 | } | 98 | } |
99 | 99 | ||
100 | [Fact] | 100 | [Fact] |
101 | public void WarnsOnVBScriptCustomAction() | ||
102 | { | ||
103 | var folder = TestData.Get(@"TestData"); | ||
104 | |||
105 | using (var fs = new DisposableFileSystem()) | ||
106 | { | ||
107 | var baseFolder = fs.GetFolder(); | ||
108 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
109 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
110 | |||
111 | var result = WixRunner.Execute(new[] | ||
112 | { | ||
113 | "build", | ||
114 | Path.Combine(folder, "CustomAction", "VBScriptCustomAction.wxs"), | ||
115 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
116 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
117 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
118 | "-intermediateFolder", intermediateFolder, | ||
119 | "-o", msiPath | ||
120 | }); | ||
121 | |||
122 | Assert.Equal(1163, result.ExitCode); | ||
123 | Assert.Equal(3, result.Messages.Length); | ||
124 | Assert.Equal(3, result.Messages.Where(m => m.Id == 1163).Count()); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | [Fact] | ||
101 | public void CanDetectCustomActionCycleWithTail() | 129 | public void CanDetectCustomActionCycleWithTail() |
102 | { | 130 | { |
103 | var folder = TestData.Get(@"TestData"); | 131 | var folder = TestData.Get(@"TestData"); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/VBScriptCustomAction.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/VBScriptCustomAction.wxs new file mode 100644 index 00000000..605ad372 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/VBScriptCustomAction.wxs | |||
@@ -0,0 +1,27 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Fragment> | ||
3 | <ComponentGroup Id="ProductComponents"> | ||
4 | <ComponentGroupRef Id="MinimalComponentGroup" /> | ||
5 | <Component Directory="INSTALLFOLDER"> | ||
6 | <File Id="VBScript.vbs" Source="test.txt" /> | ||
7 | </Component> | ||
8 | </ComponentGroup> | ||
9 | |||
10 | <Binary Id="Binary1" SourceFile="test.txt" /> | ||
11 | <CustomAction Id="Action1" VBScriptCall="EntryPoint1" BinaryRef="Binary1" /> | ||
12 | <CustomAction Id="Action1J" JScriptCall="EntryPoint1" BinaryRef="Binary1" /> | ||
13 | <CustomAction Id="Action2" VBScriptCall="EntryPoint1" FileRef="VBScript.vbs" /> | ||
14 | <CustomAction Id="Action2J" JScriptCall="EntryPoint1" FileRef="VBScript.vbs" /> | ||
15 | <CustomAction Id="Action3" Script="vbscript" ScriptSourceFile="test.txt" /> | ||
16 | <CustomAction Id="Action3J" Script="jscript" ScriptSourceFile="test.txt" /> | ||
17 | |||
18 | <InstallExecuteSequence> | ||
19 | <Custom Action="Action1" After="AppSearch" /> | ||
20 | <Custom Action="Action1J" After="Action1" /> | ||
21 | <Custom Action="Action2" After="Action1J" /> | ||
22 | <Custom Action="Action2J" After="Action2" /> | ||
23 | <Custom Action="Action3" After="Action2J" /> | ||
24 | <Custom Action="Action3J" After="Action3" /> | ||
25 | </InstallExecuteSequence> | ||
26 | </Fragment> | ||
27 | </Wix> | ||