nkolev92 / DependencyVisualizer

A tool to help you visualize the dependencies in your .NET project
MIT License
2 stars 1 forks source link

No instances of MSBuild could be detected. #33

Open ZzZombo opened 4 months ago

ZzZombo commented 4 months ago

Title. Tried to run this tool on my .NET 8 WPF project. Additionally, it appears the dotnet CLI has trouble running the tool, because it can't find it after installation, so I can only run it directly, IDK if this has anything to do with the issue at hand.

nkolev92 commented 1 month ago

Apologies for not getting to this quickly.

it appears the dotnet CLI has trouble running the tool, because it can't find it after installation, so I can only run it directly

When it comes to global tools, you sometimes need to restart your console if that's the first global tool installed.

FaithfulDev commented 2 weeks ago

I'm having the same issue. Trying to use it for an aps.net 8 project. Just installed the tool as a global tool and got the following error:

Unhandled 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 DependencyVisualizerTool.Program.GenerateGraph(FileInfo projectFile, String outputFolder, Nullable`1 checkVulnerabilities, Nullable`1 checkDeprecation, Nullable`1 projectsOnly, CancellationToken cancellationToken) in E:\Code\DependencyVisualizer\src\DependencyVisualizerTool\Program.cs:line 0
   at DependencyVisualizerTool.Program.<>c.<<Main>b__2_1>d.MoveNext() in E:\Code\DependencyVisualizer\src\DependencyVisualizerTool\Program.cs:line 67
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Restart did not help. Anything I can do to help find the issue with that?

nkolev92 commented 2 weeks ago

Which version of the .NET SDK do you have installed?

FaithfulDev commented 1 week ago

Below is the requested information. I install all my dotnet stuff via Visual Studio Installer. It should all be correctly registered and such.

dotnet --list-sdks 8.0.204 [C:\Program Files\dotnet\sdk]

dotnet --list-runtimes Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

FaithfulDev commented 1 week ago

I installed SDK 6, and that resolved the issue. The MSBuildLocator doesn't work with the newer SDK?

nkolev92 commented 1 week ago

I think it's supposed to work, but I'm wondering if it's related to the target framework of the tool, since net6.0 seems to work for you.