1. Michael Kramer
  2. SnapObjects
  3. Tuesday, 24 September 2019 12:03 PM UTC

Hi All,

This is INFORMATION - Not request for help

You may experience issue with VS Code not recognizing C# code targeted for .NET Core 3.0 if you also have SnapDevelop installed. Same issue may occur if you have any app installed that embeds MSBuild. Same issue reported by developers running Win10, Linux, or Mac.

This issue occurs often but not always.

STEPS TO REPRODUCE

  1. Ensure your VS Code has installed C# Extensions most recent version
  2. Install .NET Core 3.0 SDK
  3. Create simplest possible .NET app using command
    dotnet new console MyDemo

  4. Open VS Code to look at code in MyDemo folder

 

EXPERIENCED BAD BEHAVIOR

  • VS Code's C# extensions can't recognize System, System.Void, System.Object, System.String, etc.
  • Occurs for TargetFramework = netcoreapp3.0. in your .csproj file
  • No issue for TargetFramework = netcoreapp2.*
  • VS Code asks you to restore to fix issue but problem persists after restore.

 

RESOLUTIONS

Three different remedies seems to work:

  1. Close VS Code; install Visual Studio 2019; reopen VS Code.
  2. Close VS Code; Uninstall .NET Core 2.2 SDK; reopen VS Code; and "restore" packages

  3. (Reduced disk footprint of VS 2019)
    Close VS Code; install Build Tools for Visual Studio 2019 including [Individual components] => [.NET Core 3.0 SDK]; reopen VS Code.

CONCLUSION

This is NOT a problem in SnapDevelop. It is an inherent issue in C# Extensions for VS Code. Still, you should know how to resolve it in case it ever happens on your machine too.

HTH /Michael



There are no replies made for this question yet.
However, you are not allowed to reply to this question.