@@ -75,6 +75,30 @@ let slnPath = "SqlClient.sln"
7575let testProjectsSlnPath = " TestProjects.sln"
7676let testSlnPath = " Tests.sln"
7777let testProjectPath = " tests/SqlClient.Tests/SqlClient.Tests.fsproj"
78+ let runMsBuild project =
79+ Fake.DotNet.MSBuild.build
80+ ( fun args ->
81+ let toolPath =
82+ [
83+ @" C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
84+ @" C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\current\Bin"
85+ @" C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\current\Bin"
86+ @" C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\current\Bin"
87+ args.ToolPath
88+ ]
89+ |> List.map ( fun p -> Path.Combine( p, " MSBuild.exe" ))
90+ |> List.find File.Exists
91+ let properties =
92+ [ yield " Configuration" , " Release"
93+ for n, v in args.Properties do
94+ if n <> " Configuration" then
95+ yield n, v
96+ ]
97+ { args
98+ with ToolPath = toolPath
99+ Properties = properties
100+ } ) project
101+
78102
79103Target.create " Clean" ( fun _ ->
80104 Shell.cleanDirs [ " bin" ; " temp" ]
@@ -165,21 +189,17 @@ Target.create "DeployTestDB" (fun _ ->
165189)
166190
167191Target.create " BuildTestProjects" ( fun _ ->
168- DotNet.build
169- ( fun args ->
170- {
171- args with
172- Configuration = DotNet.Release
173- //Common = { args.Common with Verbosity = Some DotNet.Verbosity.Detailed }
174- } |> dnDefault)
175- testProjectsSlnPath
192+ DotNet.restore dnDefault testProjectsSlnPath
193+ runMsBuild testProjectsSlnPath
176194)
177195
178196// --------------------------------------------------------------------------------------
179197// Run the unit tests
180198Target.create " RunTests" ( fun _ ->
181199 // if we don't compile the targets sequentially, we get an error with the generated types:
182200 // System.IO.IOException: The process cannot access the file 'C:\Users\foo\AppData\Local\Temp\tmpF38.dll' because it is being used by another process.
201+ DotNet.restore dnDefault testSlnPath
202+ runMsBuild testSlnPath
183203 try
184204 DotNet.test ( fun args -> { args with Framework = Some " net461" ; Common = args.Common |> dnDefault }) testSlnPath
185205 DotNet.test ( fun args -> { args with Framework = Some " netcoreapp2.0" ; Common = args.Common |> dnDefault }) testProjectPath
0 commit comments