Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated version of https://github.com/fsharp/FSharp.Compiler.Service/pull/593 #597

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/absil/ilreflect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ let rec emitInstr cenv (modB : ModuleBuilder) emEnv (ilG:ILGenerator) instr =
| I_rethrow -> ilG.EmitAndLog(OpCodes.Rethrow)
| I_break -> ilG.EmitAndLog(OpCodes.Break)
#if FX_RESHAPED_REFEMIT
| I_seqpoint _ -> ()
#else
| I_seqpoint src ->
if cenv.generatePdb && not (src.Document.File.EndsWith("stdin",StringComparison.Ordinal)) then
Expand Down
4 changes: 4 additions & 0 deletions src/fsharp/fsi/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,10 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
true, // long running: optimizeForMemory
currentDirectory,isInteractive=true,
isInvalidationSupported=false)
#if NETSTANDARD1_5
do tcConfigB.useMonoResolution <- true
do tcConfigB.primaryAssembly <- PrimaryAssembly.DotNetCore
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note: This will actually disable the msbuild resolution code path. Therefore the changes below are not actually needed (at least for my case) and I never tested them. I just wanted to bring some attention there as there seems to be a problem which should be fixed...

let tcConfigP = TcConfigProvider.BasedOnMutableBuilder(tcConfigB)
#if FX_MSBUILDRESOLVER_RUNTIMELIKE
do tcConfigB.resolutionEnvironment <- MSBuildResolver.RuntimeLike // See Bug 3608
Expand Down
20 changes: 18 additions & 2 deletions src/utils/reshapedmsbuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ open System.Collections
open System.Reflection

type TaskItem (itemSpec:string) =
let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
let assembly =
Assembly.Load(
new AssemblyName(
#if !NETSTANDARD1_5
"Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
#else
"Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
#endif
))
let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task")
let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|])

Expand Down Expand Up @@ -784,7 +792,15 @@ module internal ToolLocationHelper =
// instance.GetType().GetPropserty(propName, BindingFlags.Public).SetValue(instance, propValue, null)

type ResolveAssemblyReference () =
let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
let assembly =
Assembly.Load(
new AssemblyName(
#if !NETSTANDARD1_5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is NETSTANDARD1_5 defined in both the project.json and FSharp.Compiler.Service.fsproj?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK is this defined automatically when compiling netstandard1.5 with project.json. I have no idea how it works after switching to msbuild. Most likely I should have used another symbolor added it to msbuild but i have no idea...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsproj doesnt compile for netstandard, so it's ok i think.
dotnet sdk (project.json) by default add the normalized define of the framework name under build (netstandard1.6 => NETSTANDARD1_6, 'net46=>NET46`). that's usefull, i think new msbuild target (after project.json) is going to have that too by default

"Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
#else
"Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
#endif
))
let resolveAssemblyReferenceType = assembly.GetType("Microsoft.Build.Tasks.ResolveAssemblyReference")
let instance = Activator.CreateInstance(resolveAssemblyReferenceType)

Expand Down