Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionide VS Code consistently seeing errors that don't occur when running dotnet build?

Tags:

f#

ionide

I'm on Windows using .NET Core 3.1/5.

I consistently seem to have issues with Ionide reporting errors that do not occur when running dotnet build/dotnet run, as well as seemingly locking DLL files preventing me from running dotnet build until closing VS Code, sometimes even needing to terminate the dotnet process manually.

In the past restarting VS Code when inconsistencies arise has usually resolved issues ("Clear project cache" alone rarely seems to do anything). I've been struggling with one very specific issue with a new project, though:

The exception reported was: System.IO.FileNotFoundException - Could not load file or assembly 'FSharp.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The exact message varies as I've experimented with a few combinations of package versions and framework targets (netstandard2.0, netcoreapp3.1, net5), but ultimately project definitions/DLLs that work perfectly when building/running seem to fail for a variety of reasons through Ionide.

Another example:

Detected package downgrade: FSharp.Core from 4.7.2 to 4.7.1. Reference the package directly from the project to select a different version.

Even though every .fsproj file includes the following:

<PackageReference Include="FSharp.Core" Version="4.7.2" />

What can I check to find discrepancies between how Ionide runs a build versus how dotnet build executes?

like image 654
ryachza Avatar asked Sep 21 '25 09:09

ryachza


1 Answers

Found one thing that appears to resolve the immediate issues with the current project: the .props file in the SDK has the following:

<ItemGroup Condition="'$(DisableImplicitFSharpCoreReference)' != 'true'">
  <PackageReference Include="FSharp.Core" Version="$(FSharpCoreImplicitPackageVersion)" />
</ItemGroup>

Adding:

<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>

In my .fsproj files now appears to get everything referencing the same version, rather than the prior inconsistencies between 5.0.0 (when not referenced) and 4.7.1/4.7.2 (when only 4.7.2 was referenced).

like image 157
ryachza Avatar answered Sep 23 '25 10:09

ryachza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!