Skip to content

Can't build using MSBuild.exe from VS 16.6.0 #9295

@csmager

Description

@csmager

After I upgraded my VS 2019 Build Tools to 16.6.0, my projects no longer build. I'm using net461, but I've tried net48 and netcoreapp3.1 with the same result. They do build using dotnet build, but using MSBuild.exe fails - even with a new, empty project.

I created a new project, the .fsproj file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Library.fs" />
  </ItemGroup>
</Project>

And then build using C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe.

Expected behavior

Expected to build successfully.

Actual behavior

I get 3 identical errors: Could not load file or assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified..

The relevant portion of the verbose log looks like this:

0>Task "Fsc"
0>C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe -o:obj\Debug\net48\BuildTest.dll
-g
--debug:portable
--noframework
--define:TRACE
--define:DEBUG
--define:NETFRAMEWORK
--define:NET48
--optimize-
--tailcalls-
-r:C:\Users\cmager\.nuget\packages\fsharp.core\4.7.1\lib\net45\FSharp.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Drawing.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.IO.Compression.FileSystem.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Numerics.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Runtime.Serialization.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll
-r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.Linq.dll
--target:library
--warn:3
--warnaserror:3239,76
--fullpaths
--flaterrors
--subsystemversion:6.00
--highentropyva+
--targetprofile:mscorlib
--nocopyfsharpcore
--deterministic+
--simpleresolution
obj\Debug\net48\.NETFramework,Version=v4.8.AssemblyAttributes.fs
obj\Debug\net48\BuildTest.AssemblyInfo.fs
Library.fs

0>Microsoft (R) F# Compiler version 10.9.1.0 for F# 4.7
0>Copyright (c) Microsoft Corporation. All Rights Reserved.
0>
0>C:\dev\build-test\BuildTest\unknown(0,1): Error FS0193 : Could not load file or assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
0>
0>C:\dev\build-test\BuildTest\unknown(0,1): Error FS0193 : Could not load file or assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
0>
0>C:\dev\build-test\BuildTest\unknown(0,1): Error FS0193 : Could not load file or assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
0>The command exited with code 1.
0>Done executing task "Fsc" -- FAILED.

Known workarounds

dotnet build works, though I can't use this as I have a mixed solution and my WPF projects won't build with this. Alternative is to downgrade to 16.5.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions