Skip to content

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

@pquiring

Description

@pquiring

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions