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

Failing to find the right MSBuild instance and there's no config to help the locator #1340

Closed
johnnyasantoss opened this issue Nov 19, 2018 · 4 comments · Fixed by #1349
Closed

Comments

@johnnyasantoss
Copy link
Contributor

Hello!

I'm trying to use VSCode in my solution and it keeps failing to build it because the MSBuildLocator keeps choosing the wrong instance. Is there any config that I can set to help it to select the second MSBuild instance?

Starting OmniSharp server at 11/19/2018, 11:57:18 AM
    Target: c:\dev\repos\my-project\my-project.sln

OmniSharp server started.
    Path: C:\Users\JohnnySantos\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\OmniSharp.exe
    PID: 13520

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 3 MSBuild instance(s)
            1: Visual Studio Build Tools 2017 15.9.28307.53 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            2: Visual Studio Community 2017 15.9.28307.53 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
            3: StandAlone 15.0 - "C:\Users\JohnnySantos\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2017 15.9.28307.53 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"

The first instance does not have the .net core tooling installed (it only has C++ tooling in it).
I would hope for some kind of configuration in the omnisharp.json file to make sure that this sure find an instance with the .net core tooling in it.

afbeelding

Comparing these two folders I found out that there's this folder SdkResolvers which keeps the tooling in it. So I guess that a verification for the resolvers in it would be beneficial to find the right msbuild instance.

@johnnyasantoss
Copy link
Contributor Author

I've confirmed that the second instance work just fine using the debugger and forcing the code to go to a illogical branch (VS Drag and drop arrow).

I would like to know why the MSBuildLocator doesn't take any configurations in account when selecting the msbuild instance. 🤔

@johnnyasantoss
Copy link
Contributor Author

After some investigation I found that this is a problem at the OmniSharp.MSBuild.Discovery.Extensions.RegisterDefaultInstance method where it uses the first instance with instance.DiscoveryType == DiscoveryType.Complete which might not be the best one to be selected (as in my case where I have the build tools instance before it).

@johnnyasantoss
Copy link
Contributor Author

btw: I've tested it by using the built binary in my VSCode extension folder and now I can load all the solutions that I had on my machine :)

@DustinCampbell
Copy link
Contributor

I suspect that you want a solution to #1186 in order to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants