-
Notifications
You must be signed in to change notification settings - Fork 659
Closed
Description
When adding the GitVersionTask to a fsharp fsproj that build an exe one get this error message when running dotnet build
C:\Users\...\repos\reproducegvdn\Program.fs(3,1): error FS0222: Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. [C:\Users\...\repos\reproducegvdn\reproducegvdn.fsproj]My best guess is that the generated GitVersionInformation.fs file is placed last in the list of files to compile. The Program.fs containing the decorated main function must always be last. See below for details.
Shortest steps to reproduce:
md reproducebug
cd reproducebug
dotnet new console -lang f#
dotnet add package gitversiontask
git init
git add -A
git commit -m "Initial commit"
dotnet buildIf one run with dotnet build --verbosity detailed one can find the following input to the fsc compiler (redacted for clarity). Notice the order of the files in the end.
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\2.2.300\FSharp\fsc.exe" -o:obj\Debug\netcoreapp2.2\reproducegvdn.dll
-g
--debug:portable
--noframework
--define:TRACE
--define:DEBUG
--define:NETCOREAPP
--define:NETCOREAPP2_2
--optimize-
--tailcalls-
...
--target:exe
--warn:3
--warnaserror:3239,76
--fullpaths
--flaterrors
--highentropyva-
--targetprofile:netcore
--nocopyfsharpcore
--simpleresolution
C:\Users\...\AppData\Local\Temp\.NETCoreApp,Version=v2.2.AssemblyAttributes.fs
obj\Debug\netcoreapp2.2\reproducegvdn.AssemblyInfo.fs
Program.fs
obj\Debug\netcoreapp2.2\AssemblyInfo_reproducegvdn_da4sk0i1.nf4.g.fs
obj\Debug\netcoreapp2.2\GitVersionInformation_reproducegvdn_woodujve.ebf.g.fsSame error with both SDK 2.2.300 and 3.0.100
Metadata
Metadata
Assignees
Labels
No labels