@@ -21,7 +21,6 @@ function RegisterExtractorPack(id)
2121 -- if that's `build`, we append `-p:UseSharedCompilation=false` to the command line,
2222 -- otherwise we do nothing.
2323 local match = false
24- local testMatch = false ;
2524 local dotnetRunNeedsSeparator = false ;
2625 local dotnetRunInjectionIndex = nil ;
2726 local argv = compilerArguments .argv
@@ -35,7 +34,7 @@ function RegisterExtractorPack(id)
3534 -- dotnet options start with either - or / (both are legal)
3635 local firstCharacter = string.sub (arg , 1 , 1 )
3736 if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
38- if (not match and not testMatch ) then
37+ if (not match ) then
3938 Log (1 , ' Dotnet subcommand detected: %s' , arg )
4039 end
4140 if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' then
@@ -50,12 +49,13 @@ function RegisterExtractorPack(id)
5049 dotnetRunInjectionIndex = i + 1
5150 end
5251 if arg == ' test' then
53- testMatch = true
52+ match = true
5453 end
55- -- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line
54+ -- for `dotnet [ test|run] `, we should not append `-p:UseSharedCompilation=false` to the command line
5655 -- if a library or executable is being provided as an argument.
57- if testMatch and (arg :match (' %.exe$' ) or arg :match (' %.dll' )) then
58- testMatch = false
56+ if arg :match (' %.exe$' ) or arg :match (' %.dll' ) then
57+ match = false
58+ break
5959 end
6060 end
6161 -- if we see a separator to `dotnet run`, inject just prior to the existing separator
@@ -71,7 +71,7 @@ function RegisterExtractorPack(id)
7171 dotnetRunInjectionIndex = i
7272 end
7373 end
74- if match or testMatch then
74+ if match then
7575 local injections = { ' -p:UseSharedCompilation=false' , ' -p:EmitCompilerGeneratedFiles=true' }
7676 if dotnetRunNeedsSeparator then
7777 table.insert (injections , ' --' )
0 commit comments