@@ -94,10 +94,21 @@ module CancellationToken =
9494
9595 tokenSource.token
9696
97+
98+
9799type TestId = string
98100type ProjectPath = string
99101type TargetFramework = string
100102
103+ module Project =
104+ let testPathSubDir = " .ionide-test"
105+ let getOutputPaths () =
106+ let objOutputPath = node.path.join [| " obj" ; testPathSubDir ; node.path.sep|]
107+ let baseIntermediateOutputPath = $" /p:BaseIntermediateOutputPath={objOutputPath}"
108+ let binOutputPath = node.path.join [| " bin" ; testPathSubDir; node.path.sep |]
109+ let baseOutputPath = $" /p:BaseOutputPath={binOutputPath}"
110+ [ baseIntermediateOutputPath; baseOutputPath]
111+
101112module ProjectPath =
102113 let inline ofString str = str
103114
@@ -486,8 +497,9 @@ module DotnetCli =
486497
487498 let restore
488499 ( projectPath : string )
500+ args
489501 : JS.Promise < Node.ChildProcess.ExecError option * StandardOutput * StandardError > =
490- Process.exec " dotnet" ( ResizeArray([| " restore" ; projectPath |]))
502+ Process.exec " dotnet" ( ResizeArray([| " restore" ; projectPath; yield ! args |]))
491503
492504 let private debugProcessIdRegex = RegularExpressions.Regex( @" Process Id: (.*)," )
493505
@@ -621,14 +633,16 @@ module DotnetCli =
621633 promise {
622634 let additionalArgs = if not shouldBuild then [| " --no-build" |] else Array.empty
623635
636+ let basePathArgs = Project.getOutputPaths ()
637+
624638 let! _ , stdOutput , _ =
625639 dotnetTest
626640 cancellationToken
627641 projectPath
628642 targetFramework
629643 None
630644 NoDebug
631- [| " --list-tests" ; yield ! additionalArgs |]
645+ [| " --list-tests" ; yield ! additionalArgs; yield ! basePathArgs ; " /p:BuildProjectReferences=false " |]
632646
633647 let testNames =
634648 stdOutput
@@ -1493,8 +1507,11 @@ module Interactions =
14931507 let runnableTests = TestItem.runnableFromArray projectRunRequest.Tests
14941508
14951509 let projectPath = projectRunRequest.ProjectPath
1496- let! _ = DotnetCli.restore projectPath
1497- let! buildStatus = MSBuild.invokeMSBuildWithCancel projectPath " Build" _ ct
1510+ let basePathArgs = Project.getOutputPaths ()
1511+
1512+ let! _ = DotnetCli.restore projectPath basePathArgs
1513+
1514+ let! buildStatus = MSBuild.invokeMSBuildWithCancel projectPath " Build" _ ct basePathArgs
14981515
14991516 if buildStatus.Code <> Some 0 then
15001517 TestRun.showError testRun " Project build failed" runnableTests
@@ -1568,7 +1585,11 @@ module Interactions =
15681585 promise {
15691586 let projectPath = project.Project
15701587 logger.Info( $" Building {projectPath}" )
1571- let! processExit = MSBuild.invokeMSBuildWithCancel projectPath " Build" cancellationToken
1588+
1589+ let basePathArgs = Project.getOutputPaths ()
1590+
1591+
1592+ let! processExit = MSBuild.invokeMSBuildWithCancel projectPath " Build" cancellationToken basePathArgs
15721593 return ( project, processExit)
15731594 })
15741595
0 commit comments