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

Unhandled exception. System.InvalidOperationException: No instances of MSBuild could be detected #324

Open
koldomon opened this issue Nov 9, 2022 · 5 comments · May be fixed by #372
Open

Comments

@koldomon
Copy link

koldomon commented Nov 9, 2022

today I made the update for visual studio 17.4 and installed the tool via "dotnet tool install microsoft.odata.cli -g"
everything seems fine, I didn't get any errors, but when I try to run the tool I get the following exception:

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 Microsoft.OData.Cli.Program.Main(String[] args) in D:\a\1\s\src\Microsoft.OData.Cli\Program.cs:line 10
at Microsoft.OData.Cli.Program.

(String[] args)

I'm not sure if there is a relation between the VS update and this error.

@WillEastbury
Copy link

+1 to this, I'm seeing the same issue using the raw command line tool.
odata-cli
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 Microsoft.OData.Cli.Program.Main(String[] args) in D:\a\1\s\src\Microsoft.OData.Cli\Program.cs:line 10
at Microsoft.OData.Cli.Program.

(String[] args)

@WillEastbury
Copy link

Solved it -> Install .NET 5.0 SDK.

pbru87 added a commit to pbru87/ODataConnectedService that referenced this issue Aug 31, 2023
pbru87 added a commit to pbru87/ODataConnectedService that referenced this issue Aug 31, 2023
pbru87 added a commit to pbru87/ODataConnectedService that referenced this issue Sep 2, 2023
pbru87 added a commit to pbru87/ODataConnectedService that referenced this issue Jan 29, 2024
pbru87 added a commit to pbru87/ODataConnectedService that referenced this issue Jan 29, 2024
@KenitoInc
Copy link
Contributor

@koldomon Was this issue resolved?

@batetech
Copy link

I just had the same error and installing .NET Core 6 SDK fixed the error. Link to install: https://dotnet.microsoft.com/en-us/download/dotnet/6.0

Notes: I had .NET Core 8 SDK installed already, but .NET Core 6 SDK was required in additional for this tool to work. The .NET Core 6 SDK and .NET Core 8 SDK can be installed side by side on the same machine.
I'm using odata-cli version 0.3.1 installed via: dotnet tool install --global Microsoft.OData.Cli --version 0.3.1

@ArwynFr
Copy link

ArwynFr commented Aug 10, 2024

Installing the SDK v6 also solved the problem for me with version 0.3.1.

However, I'd say that closing this ticket at least requires adding a better error message, such as "Unable to find an MSBuild instance, ensure .NET SDK version N is installed", with perhaps some link to the download page / ms documentation / winget instructions or anything that would hint the user towards the correct requirement.

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.

5 participants