The Sharp Ninja
The Sharp Ninja

Reputation: 1041

F#: Runtime error before entry point is called

Project Code: https://github.com/sharpninja/csproj-convert

I'm trying to update an old F# project to .Net 5 and am receiving this error:

PS C:\GitHub\csproj-convert> dotnet run
System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Microsoft.DotNet.Cli.Utils.Command.Execute(Action`1 processStarted)
   at Microsoft.DotNet.Cli.Utils.Command.Execute()
   at Microsoft.DotNet.Tools.Run.RunCommand.Execute()
   at Microsoft.DotNet.Tools.Run.RunCommand.Run(String[] args)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Any idea what I'm doing wrong?

Upvotes: 1

Views: 84

Answers (1)

Phillip Carter
Phillip Carter

Reputation: 5015

The issue is that it's a very old project specifying older components (from over 3 years ago) that just aren't compatible with .NET 5. Remove the following package references:

    <PackageReference Include="FSharp.Core" Version="5.0.0" />
    <PackageReference Include="FSharp.NET.Sdk" Version="1.0.5" />

The first is not necessary (and is actually specified incorrectly; Update is used to override the reference pulled in by default for any F# project). The second is an old tool that pulls in a compiler from several years ago that used to be used in .NET Core 1.0 days.

Make sure you delete your obj folder as well so it re-generates a project.assets.json file on build and you should be good to go.

Upvotes: 1

Related Questions