Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# broken in VS build tools 2019 16.6.0

Tags:

f#

After installing this version, nothing that touches F# will build, everything throws the same exception:

error FS0193: Could not load file or assembly System.Buffers, Version=4.0.3.0, blablabla..

Apparently it's nothing to do with what I'm building. Even trying to execute let x = 3 in fsi.exe has the same problem.

Anyone else had this problem?

like image 372
Benjol Avatar asked May 29 '20 11:05

Benjol


Video Answer


1 Answers

Yes, this is a known problem, see https://github.com/dotnet/fsharp/issues/9295.

While the next fix isn't out yet, you can resolve it by manually copying the missing assemblies. The exact list of missing assemblies is mentioned in this comment. The cause was explained by Kevin Ransom to be that the Setup for MSBuild didn't get the new dependencies for fsc.exe.

Note that FSI from within Visual Studio shouldn't have this issue, nor should building from within Visual Studio 2019. The way I understand it, only the MSBuild Tools are affected.

For posterity, in case the links go dead, the workaround in the Github issue is to just copy the dlls over:

copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\PublicAssemblies\*.dll" "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\FSharp"

Edit: the source path given above may not always be correct, depending on what versions of VS you've installed. Alternatively, try:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PublicAssemblies
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\PublicAssemblies

If you only want to copy the minimal set that's needed, just copy only these files, that's the diff set:

System.Buffers.dll
System.Memory.dll
System.Numerics.Vectors.dll
System.Reflection.Metadata.dll
System.Resources.Extensions.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Threading.Tasks.Dataflow.dll
like image 196
Abel Avatar answered Oct 21 '22 05:10

Abel