From 52c6e6d05fe474566f2083f133edf92ad7a406f3 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 19 Nov 2020 11:05:16 -0800 Subject: [PATCH] Update bframework refencing (#10502) --- tests/FSharp.Test.Utilities/CompilerAssert.fs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index f50a4783dc7..3e6f721379b 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -117,6 +117,16 @@ type CompilerAssert private () = """ + static let directoryBuildProps = """ + + + true + + + + +""" + static let programFs = """ open System @@ -127,13 +137,15 @@ let main argv = 0""" let mutable output = "" let mutable errors = "" let mutable cleanUp = true - let projectDirectory = Path.Combine(Path.GetTempPath(), "CompilerAssert", Path.GetRandomFileName()) + let pathToTemp = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../../Temp")) + let projectDirectory = Path.Combine(pathToTemp, "CompilerAssert", Path.GetRandomFileName()) let pathToFSharpCore = typeof.Assembly.Location try try Directory.CreateDirectory(projectDirectory) |> ignore let projectFileName = Path.Combine(projectDirectory, "ProjectFile.fsproj") let programFsFileName = Path.Combine(projectDirectory, "Program.fs") + let directoryBuildPropsFileName = Path.Combine(projectDirectory, "Directory.Build.props") let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt") #if NETCOREAPP File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "netcoreapp3.1").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) @@ -141,6 +153,7 @@ let main argv = 0""" File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #endif File.WriteAllText(programFsFileName, programFs) + File.WriteAllText(directoryBuildPropsFileName, directoryBuildProps) let pInfo = ProcessStartInfo () pInfo.FileName <- config.DotNetExe @@ -166,7 +179,9 @@ let main argv = 0""" cleanUp <- false printfn "Project directory: %s" projectDirectory printfn "STDOUT: %s" output + File.WriteAllText(Path.Combine(projectDirectory, "project.stdout"), output) printfn "STDERR: %s" errors + File.WriteAllText(Path.Combine(projectDirectory, "project.stderror"), errors) raise (new Exception (sprintf "An error occurred getting netcoreapp references: %A" e)) finally if cleanUp then