fsprojects / fsprojects/FSharpLint

Can not start the cli tool: "No instances of MSBuild could be detected"

Open
#536 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Description

I cannot start the cli tool from the beginning.

Repro steps

Please provide the steps required to reproduce the problem

  1. dotnet tool install --global dotnet-fsharplint

  2. dotnet fsharplint --help

Expected behavior

It should start.

Actual behavior
Unhandled exception. System.TypeInitializationException: The type initializer for 'FSharpLint.Console.Program' threw an exception.
 ---> System.TypeInitializationException: The type initializer for '<StartupCode$dotnet-fsharplint>.$FSharpLint.Console.Program' threw an exception.
 ---> System.InvalidOperationException: No instances of MSBuild could be detected.
Try calling RegisterInstance or RegisterMSBuildPath to manually register one.
   at Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults()
   at Ionide.ProjInfo.Init.init() in D:\a\proj-info\proj-info\src\Ionide.ProjInfo\Library.fs:line 17   at <StartupCode$dotnet-fsharplint>.$FSharpLint.Console.Program..cctor() in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Console\Program.fs:line 134
   --- End of inner exception stack trace ---
   at FSharpLint.Console.Program..cctor()
   --- End of inner exception stack trace ---
   at FSharpLint.Console.Program.main(String[] argv) in D:\a\FSharpLint\FSharpLint\src\FSharpLint.Console\Program.fs:line 138
Known workarounds

Please provide a description of any known workarounds.

No

Related information
  • Operating system: Windows 11 21H2 (22000.434)
  • Branch v0.21.0
  • .NET Runtime, CoreCLR or Mono Version .NET 6.0.101
  • Performance information, links to performance testing scripts

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with dotnet tool install --global dotnet-fsharplint followed by dotnet fsharplint --help on the reported Windows and .NET versions. Start at FSharpLint.Console/Program.fs line 134 and the Ionide.ProjInfo initialization reported at Library.fs line 17; done means the CLI starts without the MSBuild detection exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.