Omnisharp-vscode: Predefined type 'System.Void' is not defined or imported

Created on 11 Nov 2017  路  2Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

`dotnet --info` output:
Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version:1.18.0
C# Extension version:1.13.0

Steps to reproduce

After opening an existing solution or creating a new one, I get lots of errors such as Predefined type 'System.Void' is not defined or imported.

The reason for that is:

[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Enterprise 2017 15.0.26228.4 - "e:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
            2: StandAlone 15.0 - "C:\Users\Vahid\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Enterprise 2017 15.0.26228.4 - "e:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"

It's registering and using an old version of Visual Studio Enterprise 2017 instead of the new .omnisharp\msbuild\15.0\Bin path.
I'm not using and updating Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin path anymore.

Bug Resolved-Fixed

Most helpful comment

I've just pushed a new release that should help address this issue: 1.13.1. We'll be pushing this to marketplace sometime today. However, if you want to try it out, you can follow the instructions here to install it.

All 2 comments

Hi, the issue here is that you are running VS 2017 RTM. OmniSharp will try to use VS 2017 if possible, because that will provide a better experience than it's fallback MSBuild. However, VS 2017 RTM in particular has some issues.

We have a fix for this in OmniSharp, but it will be a couple of days that makes its way into C# for VS Code. For now there are few workarounds you can use in recommended order.

  1. Update VS 2017 - this is generally worthwhile anyway as there have been 4 updates since RTM.
  2. Download and use a version of OmniSharp with the a fix that will cause OmniSharp not to use VS 2017 RTM. You can follow the instructions here to do that.
  3. Install the last release of C# for VS Code (1.12.1) and change the "extensions.autoUpdate" to false.

I've just pushed a new release that should help address this issue: 1.13.1. We'll be pushing this to marketplace sometime today. However, if you want to try it out, you can follow the instructions here to install it.

Was this page helpful?
0 / 5 - 0 ratings