dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 658 forks source link

Turn off local warnings when debugging remotely #1590

Open nest-don opened 7 years ago

nest-don commented 7 years ago

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0-preview1-005977)

Product Information: Version: 2.0.0-preview1-005977 Commit SHA-1 hash: 414cab8a0b

Runtime Environment: OS Name: debian OS Version: 8 OS Platform: Linux RID: debian.8-x64 Base Path: /usr/share/dotnet/sdk/2.0.0-preview1-005977/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview1-002111-00 Build : 1ff021936263d492539399688f46fd3827169983

VS Code version: 1.13.1 C# Extension version: 1.10.0

Steps to reproduce

This isn't a bug as such. This is to do with debugging a remote project with locally mapped source.

The local project does not need to be restored and build. This is only done on the remote machine. Although project restore warnings followed by red markings appear where it find unresolved symbols in the local project.

Is there any way to turn off warnings in the local project when debugging a remote project?

Thanks.

DustinCampbell commented 7 years ago

There isn't a good way to turn off warnings and errors. Essentially, it sounds like you want OmniSharp to not load for a particular project, correct? If so, you might be able to do that be setting the "omnisharp.path" setting in the VS Code Workspace Settings to an illegal value for your project.

nest-don commented 7 years ago

Dustin, it still complains about "unresolved dependencies" in the local project.

DustinCampbell commented 7 years ago

@nest-don: It should only do that if OmniSharp is still running. I just tried setting my "omnisharp.path" to an invalid value and it worked as expected.

  1. Open your project in VS Code.
  2. Select Preferences->Settings from the menu.
  3. At the top-right corner, click "Workspace Settings"
  4. On the right-hand side of the settings.json that's opened, add "omnisharp.path": "Nope"
  5. Restart VS Code and open your project.
nest-don commented 7 years ago

Dustin,

Thank you. It works. Your help appreciated.