@@ -19,6 +19,7 @@ function RegisterExtractorPack(id)
1919 -- if that's `build`, we append `/p:UseSharedCompilation=false` to the command line,
2020 -- otherwise we do nothing.
2121 local match = false
22+ local needsSeparator = false ;
2223 local argv = compilerArguments .argv
2324 if OperatingSystem == ' windows' then
2425 -- let's hope that this split matches the escaping rules `dotnet` applies to command line arguments
@@ -31,19 +32,30 @@ function RegisterExtractorPack(id)
3132 local firstCharacter = string.sub (arg , 1 , 1 )
3233 if not (firstCharacter == ' -' ) and not (firstCharacter == ' /' ) then
3334 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
3648 break
3749 end
3850 end
3951 if match then
52+ local injections = { ' /p:UseSharedCompilation=false' }
53+ if needsSeparator then
54+ table.insert (injections , ' --' )
55+ end
4056 return {
4157 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 )
4759 }
4860 end
4961 return nil
0 commit comments