Skip to content

Error detecting msbuild version on Linux #2709

@otto-gebb

Description

@otto-gebb

Description

On Linux, FAKE outputs an error when it tries to detect the version of msbuild:

/home/gebb/_c/PrismaCloud/svc_OtaUpdater> "/usr/bin/dotnet" msbuild /version /nologo (In: false, Out: true, Err: true)
/version(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
Could not detect msbuild version from '/usr/bin/dotnet msbuild': System.Exception: msbuild failed with exitcode '1'
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\workspace_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
at [email protected](String args) in D:\a\1\s\src\app\Fake.DotNet.Cli\DotNet.fs:line 1068
at Fake.DotNet.MSBuild.getFromCall@690(String exePath, FSharpFunc`2 callMsbuildExe, Unit unitVar0) in D:\a\1\s\src\app\Fake.DotNet.MSBuild\MSBuild.fs:line 692
msbuild version '13.0.0.0' doesn't support binary logger, please set the msbuild argument 'DisableInternalBinLog' to 'true' to disable this warning.

I tried issuing the same command as FAKE does, and got this result:
image

As we see, the command would have succeeded if FAKE were using double dashes instead of slashes.

The relevant code, I believe, is here.

  let internal getVersion =
      let cache = System.Collections.Concurrent.ConcurrentDictionary<string, Version>()
      fun (exePath:string) (callMsbuildExe: string -> string) ->
          let getFromCall() =
            try
                let result = callMsbuildExe "/version /nologo"
  // ...

Repro steps

  1. Create a build script on Linux, containing a call to DotNet.build.
  2. Run the script.

Expected behavior

No error.

Actual behavior

An error is shown.

Related information

  • .NET Runtime, CoreCLR or Mono Version
    ❯ dotnet --info                       
    .NET SDK (reflecting any global.json):
     Version:   6.0.402
     Commit:    6862418796
    
    Runtime Environment:
     OS Name:     arcolinux
     OS Version:  
     OS Platform: Linux
     RID:         linux-x64
     Base Path:   /usr/share/dotnet/sdk/6.0.402/
    
    global.json file:
      Not found
    
    Host:
      Version:      6.0.10
      Architecture: x64
      Commit:       5a400c212a
    
    .NET SDKs installed:
      3.1.423 [/usr/share/dotnet/sdk]
      6.0.402 [/usr/share/dotnet/sdk]
    
    .NET runtimes installed:
      Microsoft.AspNetCore.App 3.1.29 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 6.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 3.1.29 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      Microsoft.NETCore.App 6.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    
  • Indications of severity
    Low, the error doesn't seem to prevent the build from succeeding.
  • Version of FAKE (4.X, 5.X)
    ❯ fake --version               
    FAKE 5 - F# Make (5.23.1) (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066)
    FakePath: /home/gebb/.dotnet/tools/.store/fake-cli/5.23.1/fake-cli/5.23.1/tools/net6.0/any/Fake.Runtime.dll
    Paket.Core: 6.2.1
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions