Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# exe projects fail because EntryPointAttribute attribute must be the last file #308

Closed
ctaggart opened this issue Mar 19, 2019 · 2 comments · Fixed by #309
Closed

F# exe projects fail because EntryPointAttribute attribute must be the last file #308

ctaggart opened this issue Mar 19, 2019 · 2 comments · Fixed by #309
Labels

Comments

@ctaggart
Copy link
Contributor

Order is important. Any chance the generated file can be prepended to the source list instead of appended? I'm guessing that is the issue. I'm not sure where the code is yet.

C:\projects\froto\Compiler\Program.fs(20,5): error FS0433: A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. [C:\projects\froto\Compiler\Froto.Compiler.fsproj]

See ctaggart/froto#100

@AArnott
Copy link
Collaborator

AArnott commented Mar 19, 2019

Sounds reasonable. Thanks for reporting. In the meantime you may workaround this by turning off the source file generation:

<PropertyGroup>
  <GenerateAssemblyVersionInfo>false</GenerateAssemblyVersionInfo>
</PropertyGroup>

I believe the fix will be to this line:

https://github.com/AArnott/Nerdbank.GitVersioning/blob/ab61962ac8af62f9752b696d779c1324781bae8c/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets#L166

I'm not sure if MSBuild has an Include alternative that prepends items instead of appending them. The fix might be to replace that line with:

    <!-- prepend the source file so we don't break F# console apps that have a "special" last source file -->
    <_CompileWithVersionFile Include="$(VersionSourceFile);@(Compile)" />
    <Compile Remove="@(Compile)" />
    <Compile Include="$(_CompileWithVersionFile)" />
    <_CompileWithVersionFile Remove="@(_CompileWithVersionFile)" />

@AArnott
Copy link
Collaborator

AArnott commented Mar 19, 2019

This is fixed in v2.3.138 which I just pushed to nuget.org.

AArnott added a commit that referenced this issue Dec 8, 2024
Fix to avoid deprecation warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants