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

Predefined type 'System.Void' is not defined or imported #1855

Closed
VahidN opened this issue Nov 11, 2017 · 2 comments
Closed

Predefined type 'System.Void' is not defined or imported #1855

VahidN opened this issue Nov 11, 2017 · 2 comments

Comments

@VahidN
Copy link

VahidN commented Nov 11, 2017

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.

@DustinCampbell
Copy link
Member

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.

@DustinCampbell
Copy link
Member

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.

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

No branches or pull requests

2 participants