This error is thrown likely because the file that has the EntryPoint (could be Program.cs) is not listed at the end of ItemGroup in the project’s .fsproj file. When you open it you might find something as follows:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <WarnOn>3390;$(WarnOn)</WarnOn>
    </PropertyGroup>

    <ItemGroup>
	<Compile Include="Program.fs" />
	<Compile Include="SomeOtherFile.fs" />     
    </ItemGroup>

</Project>

The compile sequence is taken from the ItemGroup elements in the .fsproj file. Notice that Program.fs is not the last one, SomeOtherFile.fs is.

The “fix” is to put Program.fs (or whichever file contains your EntryPoint) to the last position as follows:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <WarnOn>3390;$(WarnOn)</WarnOn>
    </PropertyGroup>

    <ItemGroup>
	<Compile Include="SomeOtherFile.fs" />    
        <Compile Include="Program.fs" /> 
    </ItemGroup>
</Project>

Hopefully this has fixed your issue and unblocked you. I encountered this error in Rider and you can’t “fix” it from there, you will have to go to the folder where your project is, manually edit the .fsproj file and then restart Rider for the error to fully disappear.