Closed Thorium closed 3 years ago
Or a caching problem? As sometimes running the exactly same failed build again is not failure anymore.
Also, I usually see this message in when the build fails on some other reason (in addition to the another message).
@Thorium can you try to come up with a minimal repro? I'm assuming this might be an upstream bug in FSharp.Compiler.Service
...
I expect this script to raise only one error:
#I @"./packages/build/FAKE/tools"
#r @"./packages/build/FAKE/tools/FakeLib.dll"
open Fake
open System
Target "all" (fun _ ->
()
)
Target "task2" (fun _ ->
()
)
Target "task1" ( fun _ ->
()
failwith "this should be the only failure"
)
"task1"
==> "all"
"task2"
==> "all"
RunTargetOrDefault "all"
But when build (FAKE 4.61.1, .\packages\build\Fake\tools\Fake.exe build.fsx
), it raises 2 errors, the first one is ok:
System.Exception: this should be the only failure
at FSI_0005.Build.clo@15-2.Invoke(Unit _arg3) in C:\git\myproj\build.fsx:line 17
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
But what is the second one:
System.Exception: Target "" is not defined.
at Fake.TargetHelper.getTarget@87-2.Invoke(String message) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 87
at Fake.TargetHelper.WriteTaskTimeSummary[a](a total) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 484
at Fake.TargetHelper.run$cont@655(String targetName, Unit unitVar) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 686
4.61.3 prints for me:
$ ./fake/tools/FAKE.exe
Building project with version: LocalBuild
Shortened DependencyGraph for Target all:
<== all
<== task1
<== task2
The running order is:
- task1
- task2
- all
Running build with 1 worker
Starting Target: task1
Running build failed.
Error:
System.Exception: this should be the only failure
at FSI_0005.Build.clo@15-2.Invoke(Unit _arg3) in C:\proj\testing\build.fsx:line 17
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
task1 Failure
---------------------------------------------------------------------
Status: Failure
---------------------------------------------------------------------
Can you attach the file? Maybe copy-paste produced a slightly different one?
I made a new file, and now it's only a warning, some times error, sometimes warning, but still annoying...
Had to rename it to .txt to GitHub accept it. build.fsx.txt
VS2017, Win10, .NET v4.0.30319 fsc v4.1 FAKE.4.61.1 fails
FAKE.4.62.5 works
FAKE 4.63, the same issue.
This is my build.fsx:
#r "packages/Build/FAKE/tools/FakeLib.dll"
open Fake
open DotNetCli
Target "Build" (fun _ -> Build id )
RunTargetOrDefault "Build"
And this is the result:
PS D:\Projects\LittleBoxes> .\packages\build\FAKE\tools\FAKE.exe
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
The running order is:
- Build
Running build with 1 worker
Starting Target: Build
dotnet "build" --configuration Release
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Core -> D:\Projects\LittleBoxes\Core\bin\Release\netstandard1.1\LittleBoxes.Core.dll
Activation -> D:\Projects\LittleBoxes\Activation\bin\Release\netstandard1.1\LittleBoxes.Activation.dll
Composition -> D:\Projects\LittleBoxes\Composition\bin\Release\netstandard1.1\LittleBoxes.Composition.dll
Hosting -> D:\Projects\LittleBoxes\Hosting\bin\Release\netstandard1.1\LittleBoxes.Hosting.dll
StateBased -> D:\Projects\LittleBoxes\StateBased\bin\Release\netstandard1.1\LittleBoxes.StateBased.dll
Activation.Autofac -> D:\Projects\LittleBoxes\Activation.Autofac\bin\Release\netstandard1.1\LittleBoxes.Activation.Autofac.dll
Brainfuck -> D:\Projects\LittleBoxes\Examples\Brainfuck\bin\Release\netcoreapp1.1\bfi.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.08
Finished Target: Build
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Build 00:00:02.3448186
Total: 00:00:02.4345026
---------------------------------------------------------------------
Status: Ok
---------------------------------------------------------------------
System.Exception: Target "" is not defined.
at Fake.TargetHelper.getTarget@87-2.Invoke(String message) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 87
at Fake.TargetHelper.WriteTaskTimeSummary[a](a total) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 492
at Fake.TargetHelper.run$cont@655(String targetName, Unit unitVar) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 686
at Fake.TargetHelper.run(String targetName) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 655
at Fake.AdditionalSyntax.RunTargetOrDefault(String defaultTarget) in D:\code\fake\src\app\FakeLib\AdditionalSyntax.fs:line 29
at <StartupCode$FSI_0005>.$FSI_0005_Build$fsx.main@() in D:\Projects\LittleBoxes\build.fsx:line 8
Stopped due to error
Getting the same issue with FAKE 4.64.3. Build completes, then throws the same exception as @vanufryiuk.
I tried to investigate this but ended up with two identical build scripts, one of which threw the error every time and the other one never did...
Deleting the .fake
cache folder fixed the issue.
For people still having this problem I think the root cause is https://github.com/fsharp/FAKE/issues/1765
This came back today. Deleting the .fake cache folder didn't fix the issue.
Edit: I'm still using 4.64
Ok, if I just define an empty target, then everyone is happy, and Fake will display the real problem:
Target "" (fun _ -> ())
My build-scripts randomly fails to message
Target "" is not defined. Existing targets ...
This problem wasn't there in VS2015 and Fake 4.57.4. So this is kind of regression bug of VS2017 MSBuild or new Fake (I'm using 4.61.1).
The reason is probably that my build script contains something that Fake thinks is a call to empty target. Maybe some extra spaces or something, or comments are not parsed correctly. Sample:
Or maybe it messes some spaces or brackets in the target themselves: