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

OmniSharp.MSBuild.Discovery.MSBuildLocator picks wrong MSBuild path #1941

Closed
pquiring opened this issue Dec 25, 2017 · 4 comments
Closed

OmniSharp.MSBuild.Discovery.MSBuildLocator picks wrong MSBuild path #1941

pquiring opened this issue Dec 25, 2017 · 4 comments

Comments

@pquiring
Copy link

Environment data

dotnet --info output:
.NET Command Line Tools (2.1.3)

Product Information:
Version: 2.1.3
Commit SHA-1 hash: a0ca411ca5

Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Apps\dotnet\sdk\2.1.3\

Microsoft .NET Core Shared Framework Host

Version : 2.0.4
Build : 7f262f453d8c8479b9af91d34c013b3aa05bc1ff

VS Code version: 1.19.1

C# Extension version: 1.13.1

Steps to reproduce

Install .Net Core standalone
Install VS Code
Install VS Build Tools with VC++ only (not .NET component)
or
Install VS IDE with VC++ only (not .NET component)
Open .csproj in VS Code.

Expected behavior

OmniSharp runs

Actual behavior

OmniSharp tries to use MSBuild from VC++ and fails.

Starting OmniSharp server at 12/25/2017, 12:02:45 PM
    Target: c:\files\workspace\qt\apps\passwords

OmniSharp server started
    Path: C:\Users\User\.vscode\extensions\ms-vscode.csharp-1.14.0-beta2\.omnisharp\OmniSharp.exe
    PID: 9980

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Build Tools 2017 15.5.27130.2010 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            2: StandAlone 15.0 - "C:\Users\User\.vscode\extensions\ms-vscode.csharp-1.14.0-beta2\.omnisharp\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2017 15.5.27130.2010 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\files\workspace\qt\apps\passwords'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in c:\files\workspace\qt\apps\passwords
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'c:\files\workspace\qt\apps\passwords'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\files\workspace\qt\apps\passwords\passwords.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\files\workspace\qt\apps\passwords'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\files\workspace\qt\apps\passwords' on host 1332.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\files\workspace\qt\apps\passwords\passwords.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" directory.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\files\workspace\qt\apps\passwords\passwords.csproj'.
c:\files\workspace\qt\apps\passwords\passwords.csproj


If I install .NET in VS Build Tools it works.

How can I force OmniSharp to ignore MSbuild environments that do NOT have .NET included?

Thanks.

@rchande
Copy link

rchande commented Jan 2, 2018

@DustinCampbell This is interesting. Seems like we need to actually verify that .NET is also installed for a given MSBuild installation. Thoughts on how we should do that?

@DustinCampbell
Copy link
Member

@rchande: Sorry for the delay here. We'd probably need to test for the appropriate package(s) here: https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/MSBuild/Discovery/Providers/VisualStudioInstanceProvider.cs#L56-L70.

@DustinCampbell
Copy link
Member

This issue was moved to OmniSharp/omnisharp-roslyn#1094

@DustinCampbell
Copy link
Member

I'm gone ahead and moved this over to omnisharp-roslyn, where the actually work would happen.

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

No branches or pull requests

3 participants