16

Today, my project full of these errors. Same with "string", "int", etc. I am running the latest VS Code on Yosemite. Uninstalled and reinstalled DNVM. Deleted all packages from .dnx. I can run my program, but this is really bothering me.

3rd party edit

Using visual studio code 1.73.1 on with the error is this

Type "System.Object" is not defined or imported csharp(CS0518)

Steps to reproduce

  1. Open a folder with vs code
  2. Open a terminal and run dotnet new console --use-program-main
  3. Open Program.cs and see the result below

Screen of vs-code error

VS-Code_Error

3rd party VS Code version details

Version: 1.73.1 (system setup)
Commit: 6261075646f055b99068d3688932416f2346dd3b Date: 2022-11-09T04:27:29.066Z Electron: 19.0.17
Chromium: 102.0.5005.167 Node.js: 16.14.2
V8: 10.2.154.15-electron.0

OS: Windows_NT x64 10.0.19042
Sandboxed: No

In my version

4
  • 2
    I had add to add a dependency to "System.Runtime": "4.0.20-beta-22231" to fix this condition, which seems to have appeared in the newer version 4.0.20-beta-23008. Commented Jun 13, 2015 at 23:33
  • Please post some version numbers and more about your project setup. There has been lots of instability in the last few weeks of nightly builds from ASP.NET Commented Jun 15, 2015 at 23:50
  • I have the same problem. I used yo aspnet-generator to create a console app and I get the same error on my main class. Your same fix fixed my problem too.
    – jkruer01
    Commented Jul 2, 2015 at 19:58
  • The question 75323687 may be related
    – surfmuggle
    Commented Feb 2, 2023 at 13:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.