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

Error detecting msbuild version on Linux #2709

Closed
otto-gebb opened this issue Oct 26, 2022 · 1 comment · Fixed by #2716
Closed

Error detecting msbuild version on Linux #2709

otto-gebb opened this issue Oct 26, 2022 · 1 comment · Fixed by #2716

Comments

@otto-gebb
Copy link
Contributor

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 Fake.DotNet.DotNet.callMsBuildExe@1055.Invoke(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
    
@yazeedobaid
Copy link
Collaborator

yazeedobaid commented Dec 21, 2022

Released in 6.0.0-beta001

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

Successfully merging a pull request may close this issue.

2 participants