Repository navigation
Closed
Description
Since updating to MSBuild 15.6 our build process reports warnings with a conflict on FSharp.Core.
For some reason, it has started trying to use version 4.4.3.0 of FSharp.Core.
The nuget package for FSharp.Core we are pulling is 4.4.1.0.
It seems that there is some Unification happening:
31> Unified Dependency "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
31> Using this version instead of original version "4.3.0.0" in "F:\GIT\Source\packages\FSharp.Data.TypeProviders\lib\net40\FSharp.Data.TypeProviders.dll" because AutoUnify is 'true'.
31> Using this version instead of original version "4.3.0.0" in "F:\GIT\Source\packages\FSharpx.Core\lib\40\FSharpx.Core.dll" because AutoUnify is 'true'.
31> Using this version instead of original version "4.3.1.0" in "F:\GIT\Source\packages\FsUnit\lib\net45\FsUnit.NUnit.dll" because AutoUnify is 'true'.
31> Resolved file path is "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies\FSharp.Core.dll".
31> Reference found at search path location "{AssemblyFoldersFromConfig:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\AssemblyFolders.config,v4.5}".
31> For SearchPath "F:\GIT\Source\Code\[REDACTED]\bin\Debug".
31> Considered "F:\GIT\Source\Code\[REDACTED]\bin\Debug\FSharp.Core.winmd", but it didn't exist.
31> Considered "F:\GIT\Source\Code\[REDACTED]\bin\Debug\FSharp.Core.dll",
31> but its name "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
31> didn't match the expected name "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
31> Considered "F:\GIT\Source\Code\[REDACTED]\bin\Debug\FSharp.Core.exe", but it didn't exist.
31> For SearchPath "{TargetFrameworkDirectory}".
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\FSharp.Core.winmd", but it didn't exist.
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\FSharp.Core.dll", but it didn't exist.
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\FSharp.Core.exe", but it didn't exist.
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\FSharp.Core.winmd", but it didn't exist.
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\FSharp.Core.dll", but it didn't exist.
31> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\FSharp.Core.exe", but it didn't exist.
31> For SearchPath "{AssemblyFoldersFromConfig:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\AssemblyFolders.config,v4.5}".
31> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SqlDb\FSharp.Core.winmd", but it didn't exist.
31> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SqlDb\FSharp.Core.dll", but it didn't exist.
31> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SqlDb\FSharp.Core.exe", but it didn't exist.
31> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies\FSharp.Core.winmd", but it didn't exist.
Which then leads it to this warning a bit later in the build process
31> There was a conflict between "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
31> "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
31> References which depend on "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [F:\GIT\Source\packages\FSharp.Core\lib\net45\FSharp.Core.dll].
31> F:\GIT\Source\packages\FSharp.Core\lib\net45\FSharp.Core.dll
31> Project file item includes which caused reference "F:\GIT\Source\packages\FSharp.Core\lib\net45\FSharp.Core.dll".
31> FSharp.Core
31> References which depend on "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies\FSharp.Core.dll].
31> F:\GIT\Source\packages\FSharpx.Core\lib\40\FSharpx.Core.dll
31> Project file item includes which caused reference "F:\GIT\Source\packages\FSharpx.Core\lib\40\FSharpx.Core.dll".
31> F:\GIT\Source\Code\[REDACTED]\bin\Debug\[REDACTED].dll
31> FSharpx.Core
31> F:\GIT\Source\packages\FSharp.Data.TypeProviders\lib\net40\FSharp.Data.TypeProviders.dll
31> Project file item includes which caused reference "F:\GIT\Source\packages\FSharp.Data.TypeProviders\lib\net40\FSharp.Data.TypeProviders.dll".
31> FSharp.Data.TypeProviders
31> F:\GIT\Source\packages\FsUnit\lib\net45\FsUnit.NUnit.dll
31> Project file item includes which caused reference "F:\GIT\Source\packages\FsUnit\lib\net45\FsUnit.NUnit.dll".
31> FsUnit.NUnit
31> F:\GIT\Source\Code\[REDACTED]\bin\Debug\[REDACTED].dll
31> Project file item includes which caused reference "F:\GIT\Source\Code\[REDACTED]\bin\Debug\[REDACTED].dll".
31> F:\GIT\Source\Code\[REDACTED]\bin\Debug\[REDACTED].dll
31>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3277: Found conflicts between different versions of "FSharp.Core" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
I'm not sure if this is a FSharp.Core or a MSBuild issue.
But since we are only seeing this issue with the FSharp.Core dependency, i thought it best to start here.
Metadata
Metadata
Assignees
Labels
No labels
Activity
dsyme commentedon Mar 14, 2018
Can you show us the project file for the relevant project please?
BlythMeister commentedon Mar 14, 2018
I'm trying to create a minimal viable repo of this which doesn't include any of my orgs closed source items.
dsyme commentedon Mar 14, 2018
Specifically just the Reference ItemGroup (ignoring all your own references)
BlythMeister commentedon Mar 14, 2018
Projects.zip
This is the project files and paket.lock file i have
dsyme commentedon Mar 14, 2018
I don't know why, but the HintPath references to FSharpx.Core and FSharp.Data.TypeProviders DLLs are causing an implicit reference to FSharp.Core to be added.
Something these packages have in common is that they don't correctly express their dependency on the FSharp.Core package since they are "old" F# packages from before the FSharp.Core nuget was finalized. However I don't see why referencing them should cause an implicit FSharp.Core reference. @KevinRansom Do you know why?
You might get mileage from
BlythMeister commentedon Mar 14, 2018
where do you add that xml?
Also, FSUnit is also causing a unification, but it does state the FSharp.Core in the nuget...
BlythMeister commentedon Mar 14, 2018
MinimalFSharpRepo.zip
This example needs a paket restore and build and when you look at the diagnostic build log you will see the warning
It's the most simple example i could make with literally none of our code in it.
All code is for loading references
dsyme commentedon Mar 14, 2018
You want this in all your project files:
That makes everything work OK I believe. I don't really know how/why the FSharp.Core 4.4.3.0 reference was being generated though
BlythMeister commentedon Mar 14, 2018
@dsyme I don't fully understand, Paket has already created the binding redirect in app.config. cc @forki
Zagrophyte commentedon Mar 14, 2018
@BlythMeister In your example repo, there is a property called:
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>In my experience this comes from the standard F# project template. I suspect that is what will be overriden by the
DisableImplicitFSharpCoreReferenceentry that Don is suggesting.Zagrophyte commentedon Mar 14, 2018
These entries live in the
PropertyGroupsections within each fsproj.BlythMeister commentedon Mar 14, 2018
I tried adding the disable implicit to the top property group, but it still had the warning in the build log.
Did I need to remove the target fsharp core version?
dsyme commentedon Mar 14, 2018
@BlythMeister I don't know the details, but
causes MSBuild to behave the right way. It's what you want in my experience and I've not seen any trouble with it.
BlythMeister commentedon Mar 14, 2018
Ok, I'll give that a go.and report back.
Do you just put that in all projects (regardless of language)?
Zagrophyte commentedon Mar 14, 2018
Confirmed--adding Don's suggestion of
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>to the topPropertyGroupof each fsproj made the example repo build without warnings.To be thorough, I also tried
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>but it did not avoid the issue,dsyme commentedon Mar 14, 2018
yes
dsyme commentedon Mar 14, 2018
Closing as this is some MSBuild thing
BlythMeister commentedon Mar 14, 2018
Not sure how I forgot about this...but raised feature request for Paket to do this automatically a while back....fsprojects/Paket#2573
0x53A commentedon Mar 14, 2018
The hint path thing is a bit dangerous. If the dll can't be found at the hint path, it takes an arbitrary version from the GAC.
Can you double check if the hint path exists?
BlythMeister commentedon Mar 14, 2018
Hint path definitely exists.
xperiandri commentedon Nov 13, 2021
works for me