@@ -23,6 +23,7 @@ function RegisterExtractorPack(id)
23
23
local match = false
24
24
local dotnetRunNeedsSeparator = false ;
25
25
local dotnetRunInjectionIndex = nil ;
26
+ local libOrExe = false ;
26
27
local argv = compilerArguments .argv
27
28
if OperatingSystem == ' windows' then
28
29
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -37,7 +38,7 @@ function RegisterExtractorPack(id)
37
38
if (not match ) then
38
39
Log (1 , ' Dotnet subcommand detected: %s' , arg )
39
40
end
40
- if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' or arg == ' test ' then
41
+ if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' then
41
42
match = true
42
43
break
43
44
end
@@ -48,6 +49,14 @@ function RegisterExtractorPack(id)
48
49
dotnetRunNeedsSeparator = true
49
50
dotnetRunInjectionIndex = i + 1
50
51
end
52
+ if arg == ' test' then
53
+ match = true
54
+ end
55
+ -- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line
56
+ -- if a library or executable is being provided as an argument.
57
+ if arg :match (' %.exe$' ) or arg :match (' %.dll' ) then
58
+ libOrExe = true
59
+ end
51
60
end
52
61
-- if we see a separator to `dotnet run`, inject just prior to the existing separator
53
62
if arg == ' --' then
@@ -62,7 +71,7 @@ function RegisterExtractorPack(id)
62
71
dotnetRunInjectionIndex = i
63
72
end
64
73
end
65
- if match then
74
+ if match and not libOrExe then
66
75
local injections = { ' -p:UseSharedCompilation=false' , ' -p:EmitCompilerGeneratedFiles=true' }
67
76
if dotnetRunNeedsSeparator then
68
77
table.insert (injections , ' --' )
0 commit comments