@@ -23,6 +23,10 @@ function RegisterExtractorPack(id)
23
23
not isDotnetPath (arg )
24
24
end
25
25
26
+ local function isPathToExecutable (path )
27
+ return path :match (' %.exe$' ) or path :match (' %.dll' )
28
+ end
29
+
26
30
function DotnetMatcherBuild (compilerName , compilerPath , compilerArguments ,
27
31
_languageId )
28
32
if not isDotnet (compilerName ) then
@@ -56,8 +60,16 @@ function RegisterExtractorPack(id)
56
60
NativeArgumentsToArgv (compilerArguments .nativeArgumentPointer )
57
61
end
58
62
for i , arg in ipairs (argv ) do
63
+ -- if dotnet is being used to execute any application except dotnet itself, we should
64
+ -- not inject any flags.
65
+ if not match and isPathToExecutable (arg ) and not isDotnetPath (arg ) then
66
+ Log (1 , ' Execute a .NET application usage detected' )
67
+ Log (1 , ' Dotnet path-to-application detected: %s' , arg )
68
+ break
69
+ end
59
70
if isPossibleDotnetSubcommand (arg ) then
60
- if (not match ) and inSubCommandPosition then
71
+ if not match and inSubCommandPosition then
72
+ Log (1 , ' Execute a .NET SDK command usage detected' )
61
73
Log (1 , ' Dotnet subcommand detected: %s' , arg )
62
74
end
63
75
-- only respond to strings that look like sub-command names if we have not yet
@@ -85,7 +97,7 @@ function RegisterExtractorPack(id)
85
97
end
86
98
-- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line
87
99
-- if an `exe` or `dll` is passed as an argument as the call is forwarded to vstest.
88
- if testMatch and (arg : match ( ' %.exe$ ' ) or arg : match ( ' %.dll ' ) ) then
100
+ if testMatch and isPathToExecutable (arg ) then
89
101
match = false
90
102
break
91
103
end
0 commit comments