@@ -401,7 +401,6 @@ this file.
401401 </Target >
402402
403403<!--
404-
405404 The old reference assemblies are no longer installed to `Program Files (x86)\Reference Assemblies\Microsoft\FSharp`.
406405
407406 To avoid breaking legacy projects the hint path for FSharp.Core will be rewritten if and only if the existing hint
@@ -411,23 +410,24 @@ this file.
411410 <Target Name =" RedirectFSharpCoreReferenceToNewRedistributableLocation" BeforeTargets =" ResolveAssemblyReferences" >
412411 <PropertyGroup >
413412 <_OldRootSdkLocation >$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp</_OldRootSdkLocation >
414- <_NewRootSdkLocation >$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\FSharpSdk</_NewRootSdkLocation >
413+
414+ <NewFSharpSdkLocation Condition =" '$(NewFSharpSdkLocation)' == ''" >$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\FSharpSdk</NewFSharpSdkLocation >
415415
416416 <_CoreRelativeSuffix >.NETCore\$(TargetFSharpCoreVersion)\FSharp.Core.dll</_CoreRelativeSuffix >
417417 <_FrameworkRelativeSuffix >.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.dll</_FrameworkRelativeSuffix >
418418 <_PortableRelativeSuffix >.NETPortable\$(TargetFSharpCoreVersion)\FSharp.Core.dll</_PortableRelativeSuffix >
419419
420420<!-- .NETCore-->
421421 <_OldCoreSdkPath >$(_OldRootSdkLocation)\$(_CoreRelativeSuffix)</_OldCoreSdkPath >
422- <_NewCoreSdkPath >$(_NewRootSdkLocation )\$(_CoreRelativeSuffix)</_NewCoreSdkPath >
422+ <_NewCoreSdkPath >$(NewFSharpSdkLocation )\$(_CoreRelativeSuffix)</_NewCoreSdkPath >
423423
424424<!-- .NETFramework\v4.0-->
425425 <_OldFrameworkSdkPath >$(_OldRootSdkLocation)\$(_FrameworkRelativeSuffix)</_OldFrameworkSdkPath >
426- <_NewFrameworkSdkPath >$(_NewRootSdkLocation )\$(_FrameworkRelativeSuffix)</_NewFrameworkSdkPath >
426+ <_NewFrameworkSdkPath >$(NewFSharpSdkLocation )\$(_FrameworkRelativeSuffix)</_NewFrameworkSdkPath >
427427
428428<!-- .NETPortable-->
429429 <_OldPortableSdkPath >$(_OldRootSdkLocation)\$(_PortableRelativeSuffix)</_OldPortableSdkPath >
430- <_NewPortableSdkPath >$(_NewRootSdkLocation )\$(_PortableRelativeSuffix)</_NewPortableSdkPath >
430+ <_NewPortableSdkPath >$(NewFSharpSdkLocation )\$(_PortableRelativeSuffix)</_NewPortableSdkPath >
431431 </PropertyGroup >
432432
433433 <ItemGroup >
@@ -454,6 +454,36 @@ this file.
454454 </ItemGroup >
455455 </Target >
456456
457+ <Target Name =" RedirectTPReferenceToNewRedistributableLocation" BeforeTargets =" ResolveAssemblyReferences" >
458+ <PropertyGroup >
459+ <_OldRefAssemTPLocation >$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\Type Providers\FSharp.Data.TypeProviders.dll</_OldRefAssemTPLocation >
460+ <_OldSdkTPLocationPrefix >$(MSBuildProgramFiles32)\Microsoft SDKs\F#</_OldSdkTPLocationPrefix >
461+ <_OldSdkTPLocationSuffix >Framework\v4.0\FSharp.Data.TypeProviders.dll</_OldSdkTPLocationSuffix >
462+
463+ <NewFSharpCompilerLocation Condition =" '$(NewFSharpCompilerLocation)' == ''" >$(MSBuildThisFileDirectory)</NewFSharpCompilerLocation >
464+ <NewFSharpCompilerLocation Condition =" !HasTrailingSlash('$(NewFSharpCompilerLocation)')" >$(NewFSharpCompilerLocation)\</NewFSharpCompilerLocation >
465+ </PropertyGroup >
466+
467+ <ItemGroup >
468+ <!-- Update references to FSharp.Data.TypeProviders.dll-->
469+ <Reference Condition =" '%(Reference.Identity)' == 'FSharp.Data.TypeProviders' and
470+ '%(Reference.HintPath)' == '$(_OldRefAssemTPLocation)' and
471+ Exists('$(NewFSharpCompilerLocation)FSharp.Data.TypeProviders.dll')" >
472+ <HintPath >$(NewFSharpCompilerLocation)FSharp.Data.TypeProviders.dll</HintPath >
473+ </Reference >
474+
475+ <!-- Update references to FSharp.Data.TypeProviders.dll-->
476+ <Reference Condition =" '%(Reference.Identity)' == 'FSharp.Data.TypeProviders' and
477+ $([System.String]::new('%(Reference.HintPath)').StartsWith('$(_OldSdkTPLocationPrefix)', System.StringComparison.OrdinalIgnoreCase)) and
478+ $([System.String]::new('%(Reference.HintPath)').EndsWith('$(_OldSdkTPLocationSuffix)', System.StringComparison.OrdinalIgnoreCase)) and
479+ Exists('$(NewFSharpCompilerLocation)FSharp.Data.TypeProviders.dll')" >
480+
481+ <HintPath >$(NewFSharpCompilerLocation)FSharp.Data.TypeProviders.dll</HintPath >
482+ </Reference >
483+
484+ </ItemGroup >
485+ </Target >
486+
457487 <Import Project =" $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition =" '$(ImportByWildcardAfterMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')" />
458488
459489</Project >