@@ -19,6 +19,7 @@ function RegisterExtractorPack(id)
19
19
-- if that's `build`, we append `/p:UseSharedCompilation=false` to the command line,
20
20
-- otherwise we do nothing.
21
21
local match = false
22
+ local needsSeparator = false ;
22
23
local argv = compilerArguments .argv
23
24
if OperatingSystem == ' windows' then
24
25
-- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -31,19 +32,30 @@ function RegisterExtractorPack(id)
31
32
local firstCharacter = string.sub (arg , 1 , 1 )
32
33
if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
33
34
Log (1 , ' Dotnet subcommand detected: %s' , arg )
34
- if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' or arg == ' test' or
35
- arg == ' run' then match = true end
35
+ if arg == ' build' or arg == ' msbuild' or arg == ' publish' or arg == ' pack' or arg == ' test' then
36
+ match = true
37
+ break
38
+ end
39
+ if arg == ' run' then
40
+ -- for `dotnet run`, we need to make sure that `/p:UseSharedCompilation=false` is
41
+ -- not passed in as an argument to the program that is run
42
+ match = true
43
+ needsSeparator = true
44
+ end
45
+ end
46
+ if arg == ' --' then
47
+ needsSeparator = false
36
48
break
37
49
end
38
50
end
39
51
if match then
52
+ local injections = { ' /p:UseSharedCompilation=false' }
53
+ if needsSeparator then
54
+ table.insert (injections , ' --' )
55
+ end
40
56
return {
41
57
order = ORDER_REPLACE ,
42
- invocation = BuildExtractorInvocation (id , compilerPath ,
43
- compilerPath ,
44
- compilerArguments , nil , {
45
- ' /p:UseSharedCompilation=false'
46
- })
58
+ invocation = BuildExtractorInvocation (id , compilerPath , compilerPath , compilerArguments , nil , injections )
47
59
}
48
60
end
49
61
return nil
0 commit comments