ODataConnectedService
ODataConnectedService copied to clipboard
Unhandled exception. System.InvalidOperationException: No instances of MSBuild could be detected
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.<Main>(String[] args)
I'm not sure if there is a relation between the VS update and this error.
+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.<Main>(String[] args)
Solved it -> Install .NET 5.0 SDK.
@koldomon Was this issue resolved?
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
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.