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

MSBuild 16.6 breakage #2515

Closed
Seltzer opened this issue May 21, 2020 · 16 comments
Closed

MSBuild 16.6 breakage #2515

Seltzer opened this issue May 21, 2020 · 16 comments

Comments

@Seltzer
Copy link

Seltzer commented May 21, 2020

Description

We use FAKE to invoke msbuild in order to build .NET Framework projects. It appears that with a recent minor version upgrade of Visual Studio (and hence MSBuild) from 16.3 or 4 to 16.6 that Fake.DotNet.MSBuild.build has stopped working with default settings

Repro steps

  1. Install latest version of MSBuild
  2. Call Fake.DotNet.MSBuild.build with mostly default config.

Expected behavior

Project builds.

Actual behavior

Receive an error like the following.

Script reported an error, see standard error for details.
-> BuildFailedException: Target 'Compile' failed.
StackTrace:
at Fake.Core.TargetModule.raiseIfError(OptionalTargetContext context) in D:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 820
at Fake.Core.TargetModule.runOrDefault(String defaultTarget) in D:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 936
at <StartupCode$Targets_41CEEBA08822BCF9CD93022A20989A8ABA0CB6981524E297427CBA1A1ADD1235>.$Targets$fsx.main@() in C:\Dev\dccmc~\BuildPackageDeploy\Targets.fsx:line 340
-> One or more errors occurred. (Unsupported log file format. Latest supported version is 7, the log file has version 9.)
-> NotSupportedException: Unsupported log file format. Latest supported version is 7, the log file has version 9.
StackTrace:
at Microsoft.Build.Logging.StructuredLogger.BinLogReader.ReadRecordsFromDecompressedStream(Stream decompressedStream)+MoveNext() in C:\MSBuildStructuredLog\src\StructuredLogger\BinaryLogger\BinLogReader.cs:line 214
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 178
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable1 source) at Fake.DotNet.MSBuildBinLog.getErrorsAndWarnings(String binLogFilePath) in D:\a\1\s\src\app\Fake.DotNet.MSBuild\BinLog.fs:line 32 at Fake.DotNet.MSBuild.handleAfterRun(String command, FSharpOption1 binLogPath, Int32 exitCode, String project) in D:\a\1\s\src\app\Fake.DotNet.MSBuild\MSBuild.fs:line 733
at Fake.DotNet.MSBuild.build(FSharpFunc2 setParams, String project) in D:\a\1\s\src\app\Fake.DotNet.MSBuild\MSBuild.fs:line 844 at CommonBuild.build@165-1.Invoke(String project) in C:\Dev\dccmc\~\BuildPackageDeploy\Nbf\CommonBuild.fsx:line 165 at Microsoft.FSharp.Primitives.Basics.List.iter[T](FSharpFunc2 f, FSharpList1 x) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 91 at CommonBuild.build(String outputPath, String targets, FSharpOption1 verbosity, FSharpFunc2 properties, IEnumerable1 projects) in C:\Dev\dccmc~\BuildPackageDeploy\Nbf\CommonBuild.fsx:line 167
at CommonBuild.Build@199.Invoke(Project proj) in C:\Dev\dccmc~\BuildPackageDeploy\Nbf\CommonBuild.fsx:line 205
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source) in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 497
at Targets.clo@50-1.Invoke(TargetParameter _arg2) in C:\Dev\dccmc~\BuildPackageDeploy\Targets.fsx:line 50
at Fake.Core.TargetModule.runSimpleInternal(TargetContext context, Target target) in D:\a\1\s\src\app\Fake.Core.Target\Target.fs:line 201

Known workarounds

Set DisableInternalBinLog flag to prevent FAKE processing MSBuild binary logs and sidestep any sort of log format incongruence.

I'm guessing this might possibly be fixed / worked around by using a different version of StructuredLogger?

Related information

  • Windows 10
  • .NET 4.7
  • High
  • FAKE 5.20.0
@github-actions
Copy link

Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!

@isaacabraham
Copy link
Contributor

Confirmed. This is the same issue if you have .NET 5 installed - FAKE doesn't know the log file version and throws a wobbly.

@0x53A
Copy link
Contributor

0x53A commented May 24, 2020

I also had this issue, but it was fixed after updating fake-cli and all packages.

@mccsoft
Copy link

mccsoft commented May 25, 2020

I also had this issue, but it was fixed after updating fake-cli and all packages.

Confirmed.
OS: Ubuntu 18.04.4 LTS
FAKE 5 - F# Make (5.20.0)
dotnet --version: 3.1.300
Removing paket.lock file and updating as option version of paket.dependencies to 5.245.1 resolved this issue.

@jernejk
Copy link

jernejk commented May 29, 2020

Hi,
I updated everything, removed packet.lock and even removed packages folders and it doesn't work.

What do I need to do regarding updating as option version of paket.dependencies to 5.245.1?

OS: Windows 10 2004
FAKE 5 - F# Make (5.20.0)
.NET Framework 4.7 is the target app (it only fails after msbuild is successful, no .NET Core or .NET Standard libs)
dotnet --version: 3.1.300

Our paket.dependencies:

    source https://nuget.org/api/v2
    framework >= net461

    nuget FSharp.Core
    nuget Fake.Core.Target
    nuget Fake.JavaScript.Yarn
    nuget Fake.DotNet.MSBuild
    nuget Fake.DotNet.NuGet
    nuget Fake.DotNet.Testing.XUnit2

    nuget xunit.runner.console
    nuget xunit.runner.visualstudio

image

This worked 3-5 days ago.

gtbuchanan added a commit to gtbuchanan/Luhny that referenced this issue Jun 1, 2020
gtbuchanan added a commit to gtbuchanan/BaseNcode that referenced this issue Jun 1, 2020
gtbuchanan added a commit to gtbuchanan/Luhny that referenced this issue Jun 1, 2020
gtbuchanan added a commit to gtbuchanan/BaseNcode that referenced this issue Jun 1, 2020
gtbuchanan added a commit to gtbuchanan/BaseNcode that referenced this issue Jun 1, 2020
@jernejk
Copy link

jernejk commented Jun 4, 2020

Unless I'm missing something, updating FAKE doesn't help at all.
Any ideas which particular dependency I need to upgrade or perhaps add?

@0x53A
Copy link
Contributor

0x53A commented Jun 4, 2020

Yeah, you need to update the msbuild log viewer thing.

@jernejk
Copy link

jernejk commented Jun 4, 2020

These are the current dependencies that we use:

    source https://nuget.org/api/v2
    framework >= net461

    nuget FSharp.Core
    nuget Fake.Core.Target
    nuget Fake.JavaScript.Yarn
    nuget Fake.DotNet.MSBuild
    nuget Fake.DotNet.NuGet
    nuget Fake.DotNet.Testing.XUnit2

    nuget xunit.runner.console
    nuget xunit.runner.visualstudio

I have noticed that most of the repos that have fixed this issue also have nuget Fake.DotNet.Cli but this does not fix the issue for .NET Framework.

Any idea how can I find msbuild log viewer package?
Upgrading Fake.DotNet.MSBuild doesn't seem to be the solution.

@0x53A
Copy link
Contributor

0x53A commented Jun 4, 2020

Fake.DotNet.MSBuild depends on MSBuild.StructuredLogger, which you need to update.

Sorry, I'm on the phone and didn't know the exact package name before.

@jernejk
Copy link

jernejk commented Jun 4, 2020

It already used the latest one and forcing it to install the latest one didn't work either.
I tried to upgrade everything:

  • net461 to net 472
  • all dependencies including Paket and FAKE
  • remove all folders that includes packages
  • removed .locks
  • removed .fake folder
  • installed everything basically from scratch

Still not working.
Is there anything else I can do?
I haven't done any changes to .paket/Paket.Restore.targets and .paket/Paket.targets

This is the upgrade script:

RMDIR /Q/S paket-files
RMDIR /Q/S packages
RMDIR /Q/S tools\.fake
DEL /F/Q/S "paket.lock" > NUL

.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit /b %errorlevel%
)

.paket\paket.exe update
if errorlevel 1 (
   exit /b %errorlevel%
)

dotnet tool install fake-cli --tool-path .\tools\.fake --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources

And this are the resolved dependencies:

Checking Paket version (downloading latest stable)...
Paket.exe 5.245.2 is up to date.
Paket version 5.245.2
Resolving packages for group Main:
 - MSBuild.StructuredLogger 2.1.133
 - FSharp.Core 4.7.2
 - Fake.Core.Target 5.20.0
 - Fake.DotNet.Cli 5.20.0
 - Fake.JavaScript.Yarn 5.20.0
 - Fake.DotNet.MSBuild 5.20.0
 - Fake.DotNet.NuGet 5.20.0
 - Fake.DotNet.Testing.XUnit2 5.20.0
 - xunit.runner.console 2.4.1
 - xunit.runner.visualstudio 2.4.2
 - Microsoft.Build 16.5.0
 - Microsoft.Build.Framework 16.5.0
 - Microsoft.Build.Tasks.Core 16.5.0
 - Newtonsoft.Json 12.0.3
 - Fake.Core.CommandLineParsing 5.20.0
 - Fake.Core.Context 5.20.0
 - Fake.Core.Environment 5.20.0
 - Fake.Core.FakeVar 5.20.0
 - Fake.Core.Process 5.20.0
 - Fake.Core.String 5.20.0
 - Fake.Core.Trace 5.20.0
 - Fake.IO.FileSystem 5.20.0
 - Fake.Core.SemVer 5.20.0
 - Fake.Core.Tasks 5.20.0
 - Fake.Core.Xml 5.20.0
 - Fake.Net.Http 5.20.0
 - Fake.Testing.Common 5.20.0
 - NuGet.Protocol 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - System.IO.Compression 4.3.0
 - FSharp.Control.Reactive 4.3.0
 - Mono.Posix.NETStandard 1.0.0
 - BlackFox.VsWhere 1.0.0
 - Microsoft.Build.Utilities.Core 16.5.0
 - NuGet.Packaging 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - System.Threading.Tasks.Dataflow 4.11.1
 - System.Resources.Extensions 4.7.1
 - System.Memory 4.5.4
 - System.CodeDom 4.7.0
 - System.Net.Http 4.3.4
 - System.Reactive 4.4.1
 - Microsoft.Win32.Registry 4.7.0
 - System.Dynamic.Runtime 4.3.0
 - System.Runtime.Serialization.Primitives 4.3.0
 - System.Reflection.TypeExtensions 4.7.0
 - System.Linq.Parallel 4.3.0
 - System.Threading.Thread 4.3.0
 - System.Resources.Writer 4.3.0
 - Microsoft.VisualStudio.Setup.Configuration.Interop 1.16.30
 - System.Collections.Immutable 1.7.1
 - System.Reflection.Metadata 1.8.1
 - FParsec 1.1.1
 - NuGet.Configuration 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - NuGet.Versioning 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - System.Security.AccessControl 4.7.0
 - System.Security.Principal.Windows 4.7.0
 - System.Threading.Tasks.Extensions 4.5.4
 - System.Runtime.CompilerServices.Unsafe 4.7.1
 - System.Buffers 4.5.1
 - System.Numerics.Vectors 4.5.0
 - System.ValueTuple 4.5.0
 - System.Security.Cryptography.X509Certificates 4.3.2
 - System.Text.Encoding.CodePages 4.7.1
 - NuGet.Common 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - System.Security.Cryptography.ProtectedData 4.7.0
 - System.Security.Cryptography.Algorithms 4.3.1
 - System.Security.Cryptography.Encoding 4.3.0
 - NuGet.Frameworks 5.6.0+636570e68732c1f718ede9ca07802d7b1cc69aa0
 - System.Diagnostics.Process 4.3.0
 - System.IO 4.3.0
 - System.Runtime 4.3.1
 - System.Security.Cryptography.Primitives 4.3.0

@0x53A
Copy link
Contributor

0x53A commented Jun 4, 2020

I doubt it will help, but can you set the env var FAKE_DETAILED_ERRORS to true?

I think then it will show the exact stack trace. Maybe that gives a hint.

From your description, I believe you did everything correctly.

(It's 4am, so I'm going to sleep ...)

@jernejk
Copy link

jernejk commented Jun 4, 2020

Thanks for the help at such a late hour, I'm from Australian, so it's noon on our side. :)

I managed to find the problem!
I needed to remove all *.fsx.lock files, not just the global one!
Also, I went through all of the *.fsx files to make sure they don't depend on a specific version of a nuget package.

A new upgrade script should help others who have a similar problems and struggle to understand why it's not working.

RMDIR /Q/S paket-files
RMDIR /Q/S packages
RMDIR /Q/S tools\.fake
DEL /F/Q/S "paket.lock" > NUL
DEL /F/Q/S "tools\*.fsx.lock" > NUL

:: Update paket and FAKE
.paket\paket.bootstrapper.exe
if errorlevel 1 (
  exit /b %errorlevel%
)

.paket\paket.exe update
if errorlevel 1 (
   exit /b %errorlevel%
)

dotnet tool install fake-cli --tool-path .\tools\.fake --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources

@matthid
Copy link
Member

matthid commented Jun 13, 2020

I haven't looked into details but from what I read is that all I need to do is updates packages and release again to solve this? Or is there something else to do here?

@jernejk
Copy link

jernejk commented Jun 14, 2020

Partially correct.
Updating is easy, figuring out why it's not working only to realize that update only worked globally but for the individual file was a different matter. ☺

@stroborobo
Copy link

Fake.DotNet.MSBuild depends on MSBuild.StructuredLogger, which you need to update.

This did the trick for me, thanks!

@matthid
Copy link
Member

matthid commented Jun 27, 2020

As we now directly depend on the updated MSBuild.StructuredLogger with 5.20.2 I'm closing this.

@matthid matthid closed this as completed Jun 27, 2020
aaronpowell added a commit to aaronpowell/FSharp.CosmosDb that referenced this issue Jul 1, 2020
Booksbaum added a commit to Booksbaum/ts2fable that referenced this issue Jan 17, 2021
Error:
> Unsupported log file format. Latest supported version is 8, the log
file has version 9.

Solution: Update group netcorebuild (`dotnet paket update --group netcorebuild`).
See fsprojects/FAKE#2515

While finding the issue:
Update paket to dotnet tool (was first thing I tried...)
mthierba added a commit to pbi-tools/pbi-tools that referenced this issue Oct 11, 2021
* dotnet paket update -g Fake-Build
* Fixes fsprojects/FAKE#2515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants