Skip to content

Builds against target framework net35/net40 fail with the VS16.5 update -- Cannot read or write file Fsharp.Core.dll #8739

@SteveGilham

Description

@SteveGilham

Builds of F# projects against target framework net35 fail with the VS16.5 update. This happens with both old-style long-form projects or the new lightweight ones.

Repro steps

The simplest repro is

  1. dotnet new classlib -lang F#
  2. edit project as follows to target .Net Framework 3.5
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net35</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Library.fs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="FSharp.Core" Version="3.0.2" />
  </ItemGroup>

</Project>
  1. dotnet restore
  2. msbuild [project]

Expected behavior

Trivial compilation just works

Actual behavior

"C:\Users\steve\Documents\scratch\scratch.fsproj" (default target) (1) ->
(CoreCompile target) ->
  FSC : error FS0229: Error opening binary file 'C:\Users\steve\.nuget\packages\fsharp.core\3.0.2\lib\net35\FSharp.Core .dll': Cannot read or write file [C:\Users\steve\Documents\sscratch\scratch.fsproj]
  FSC : error FS3160: Problem reading assembly 'C:\Users\steve\.nuget\packages\fsharp.core\3.0.2\lib\net35\FSharp.Core. dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\steve\.nuget\packages\fsharp.core\3.0.2\lib\net35\FSharp.Co re.dll': Cannot read or write file) [C:\Users\steve\Documents\scratch\scratch.fsproj]
  error FS0073 : internal error : BuildFrameworkTcImports: no successful import of C:\Users\steve\.nuget\packages\fshar p.core\3.0.2\lib\net35\FSharp.Core.dll [C:\Users\steve\Documents\scratch\scratch.fsproj]

Known workarounds

Using an older compiler version

Related information

Windows 10 Home build 1909
Visual Studio 16.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions