ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.
MIT License
241 stars 44 forks source link

Package restore fails after upgrade to .NET SDK 5.0.300 #95

Closed rdipardo closed 2 years ago

rdipardo commented 3 years ago

Describe the bug

The installed version of MSBuild.StructuredLogger is incompatible with .NET SDK version 5.0.300 (and probably later); package restore fails with the error message:

NotSupportedException: Unsupported log file format. Latest supported version is 9, the log file has version 13.

To Reproduce

  1. Update your SDK to 5.0.300 (or newer):

    $ dotnet --list-sdks
    3.1.409 [/usr/share/dotnet/sdk]
    5.0.300 [/usr/share/dotnet/sdk]
  2. Apply the upgrades proposed in #86

$ curl https://github.com/ionide/Fornax/commit/7e28242e21101ea471241f93b56434660960c58d.diff | git apply -v
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   592  100   592    0     0   2114      0 --:--:-- --:--:-- --:--:--  2106
Checking patch .config/dotnet-tools.json...
Checking patch global.json...
Applied patch .config/dotnet-tools.json cleanly.
Applied patch global.json cleanly.
  1. Try to build
dotnet fake build -> "BuildFailedException: Target 'Restore' failed."
$ dotnet tool restore
Tool 'fake-cli' (version '5.20.4') was restored. Available commands: fake
Tool 'paket' (version '5.257.0') was restored. Available commands: paket

Restore was successful.

$ dotnet fake build
Starting full restore process.
run Pack
Building project with version: LocalBuild
Shortened DependencyGraph for Target Pack:
<== Pack
   <== Default
      <== Test
         <== Publish
            <== Build
               <== Restore
                  <== AssemblyInfo
                     <== Clean

The running order is:
Group - 1
  - Clean
Group - 2
  - AssemblyInfo
Group - 3
  - Restore
Group - 4
  - Build
Group - 5
  - Publish
Group - 6
  - Test
Group - 7
  - Default
Group - 8
  - Pack
Starting target 'Clean'
Finished (Success) 'Clean' in 00:00:00.0201291
Starting target 'AssemblyInfo'
Finished (Success) 'AssemblyInfo' in 00:00:00.0799084
Starting target 'Restore'
Starting task 'DotNet:restore'
> "/usr/bin/mono" --version (In: false, Out: true, Err: true)
/home/rob/dev/Fornax> "dotnet"  msbuild /version /nologo (In: false, Out: true, Err: true)
16.10.0.26302
/home/rob/dev/Fornax> "dotnet"  restore "" /bl:/tmp/tmp22hDDJ.tmp.binlog (In: false, Out: false, Err: false)
/usr/share/dotnet/sdk/5.0.300/MSBuild.dll -nologo -maxcpucount -target:Restore -verbosity:m /bl:/tmp/tmp22hDDJ.tmp.binlog ./Fornax.sln
  Determining projects to restore...
  Paket version 5.257.0
  Starting restore process.
  Performance:
   - Runtime: 5 seconds
  Restored /home/rob/dev/Fornax/src/Fornax.Core/Fornax.Core.fsproj (in 1.06 sec).
  Restored /home/rob/dev/Fornax/test/Fornax.Core.UnitTests/Fornax.Core.UnitTests.fsproj (in 1.06 sec).
  Restored /home/rob/dev/Fornax/src/Fornax/Fornax.fsproj (in 1.59 sec).
Finished (Failed) 'DotNet:restore' in 00:00:15.0830548
Finished (Failed) 'Restore' in 00:00:15.0975829

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target         Duration
------         --------
Clean          00:00:00.0048055
AssemblyInfo   00:00:00.0796770
Restore        00:00:15.0970538   (Unsupported log file format. Latest supported version is 9, the log file has version 13.)
Build          00:00:00           (skipped)
Publish        00:00:00           (skipped)
Test           00:00:00           (skipped)
Default        00:00:00           (skipped)
Pack           00:00:00           (skipped)
Total:         00:00:15.6136692
Status:        Failure
---------------------------------------------------------------------
Script reported an error:
-> BuildFailedException: Target 'Restore' failed.
-> One or more errors occurred. (Unsupported log file format. Latest supported version is 9, the log file has version 13.)
-> NotSupportedException: Unsupported log file format. Latest supported version is 9, the log file has version 13.
Hint: To further diagnose the problem you can run fake in verbose mode `fake -v run ...` or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'
Performance:
 - Cli parsing: 795 milliseconds
 - Packages: 7 seconds
   - Creating Runtime Graph: 216 milliseconds
   - Retrieve Assembly List: 3 seconds
 - Script compiling: 19 seconds
 - Script analyzing: 988 milliseconds
 - Script running: 16 seconds
 - Script cleanup: 121 milliseconds
 - Runtime: 54 seconds

Expected behaviour

The restore target should succeed without having to downgrade the SDK

Environment

Additional context

Bumping MSBuild.StructuredLogger to a newer version seems to resolve this issue:

diff --git a/paket.lock b/paket.lock
index c0b4fff..032a2e0 100644
--- a/paket.lock
+++ b/paket.lock
@@ -761,7 +761,7 @@ NUGET
       System.Security.AccessControl (>= 4.7) - restriction: || (&& (>= monoandroid) (< netstandard2.0)) (>= monotouch) (&& (< net46) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.0) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
       System.Security.Principal.Windows (>= 4.7) - restriction: || (&& (>= monoandroid) (< netstandard2.0)) (>= monotouch) (&& (< net46) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.0) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
     Mono.Posix.NETStandard (1.0) - restriction: || (>= net462) (>= netstandard2.0)
-    MSBuild.StructuredLogger (2.1.117) - restriction: || (>= net462) (>= netstandard2.0)
+    MSBuild.StructuredLogger (2.1.507) - restriction: || (>= net462) (>= netstandard2.0)
       Microsoft.Build (>= 16.4) - restriction: >= netstandard2.0
       Microsoft.Build.Framework (>= 16.4) - restriction: >= netstandard2.0
       Microsoft.Build.Tasks.Core (>= 16.4) - restriction: >= netstandard2.0
rdipardo commented 2 years ago

Obsoleted by 9102720