Be nice, I’m a total newbie to F#. I have created my first console app, and I can’t figure out how F# decides which of my .fs files its going to run on startup. Normally apps have an entry point, and the F# forms projects I’ve seen have an entry point. My console project does not.
It always seems to start with the last file I’ve added, which is a giant pain. I can’t believe its supposed to work this way. I must be doing something wrong.
F# does support entry points, with EntryPointAttribute. See the last screenshot of this blog for details. The ‘main’ function takes a string array and returns an int, and the EntryPoint must be in the last code file in the project. See also 12.1.4 of the language spec.
Note that if you do not provide an explicit entry point, then the ‘top level code’ in the last file of the project effectively behaves like ‘main’.
(Incidentally, see also this blog for info on managing ordering files in a project inside VS.)