question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow choosing the Target Framework.

See original GitHub issue

Issue Description

As a user who has to target multiple Target Framework versions, I would like to be able to choose the specific framework Omnisharp should use. This functionality is homologous to this Visual Studio feature:

image

This will allow macro’s like #if NETSTANDARD and #if NETFRAMEWORK to work correctly and provide intellisense in those areas.

Environment information

VSCode version: 1.44.2 C# Extension: 1.21.17

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7

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

Host (useful for support): Version: 3.1.3 Commit: 4a9f85e9f8

.NET Core SDKs installed: 2.1.504 [C:\Program Files\dotnet\sdk] 2.1.508 [C:\Program Files\dotnet\sdk] 2.1.602 [C:\Program Files\dotnet\sdk] 2.1.700 [C:\Program Files\dotnet\sdk] 2.1.801 [C:\Program Files\dotnet\sdk] 2.2.202 [C:\Program Files\dotnet\sdk] 2.2.300 [C:\Program Files\dotnet\sdk] 2.2.401 [C:\Program Files\dotnet\sdk] 3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk] 3.1.101 [C:\Program Files\dotnet\sdk] 3.1.201 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
azure-account ms-vscode 0.8.9
csharp ms-dotnettools 1.21.17
debugger-for-chrome msjsdiag 4.12.6
debugger-for-edge msjsdiag 1.0.14
docomment k–kato 0.1.9
dotnet-test-explorer formulahendry 0.7.1
ecdc mitchdenny 1.3.0
EditorConfig EditorConfig 0.14.5
gitlens eamodio 10.2.1
markdown-all-in-one yzhang 2.8.0
msbuild-project-tools tintoy 0.3.5
ng-template Angular 0.901.4
partial-diff ryu1kn 1.4.1
terraform mauve 1.4.0
uridecode sryze 0.3.5
vscode-icons vscode-icons-team 10.1.1
vscode-solution-explorer fernandoescolar 0.3.9
vscode-typescript-tslint-plugin ms-vscode 1.2.3
vscode-versionlens pflannery 0.26.0
vscode-xml redhat 0.11.0
vscode-yaml redhat 0.7.2
vscodeintellicode VisualStudioExptTeam 1.2.6
vsliveshare ms-vsliveshare 1.0.2104

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:18
  • Comments:7

github_iconTop GitHub Comments

1reaction
pellaredcommented, Apr 7, 2021

When trying to use VS Code for the development of https://github.com/open-telemetry/opentelemetry-dotnet I get a ton of errors like:

Assembly 'OpenTelemetry.Api' with identity 'OpenTelemetry.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7bd6737fe5b67e3c' uses 'System.Diagnostics.DiagnosticSource, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' which has a higher version than referenced assembly 'System.Diagnostics.DiagnosticSource' with identity 'System.Diagnostics.DiagnosticSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [OpenTelemetry.Tests]

I guess that this is because the assemblies inside the System.Diagnostics.DiagnosticSource NuGet package have different versions for different targets. net45 and net46 have version 5.0.0.1 while the others (net5, netstandard1.1 and netstandard1.3) have 5.0.0.0. My understanding is that VSCode C# extension uses net452 for OpenTelemetry.Api and netcoreapp2.1 for OpenTelemetry.Tests as TargetFrameworks (because of https://github.com/OmniSharp/omnisharp-vscode/issues/1783).

Having the ability to choose a platform could help I guess. It should basically help in any project which targets multiple frameworks.

0reactions
Sour-Codescommented, Oct 24, 2022

In full support of this thread. It’s the 1+ VS has over Code. Can’t imagine how much time I lost over the years to reorder target framework first, restart Omnisharp, and wait for the service to boot up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Targeted .NET Frameworks - Visual Studio (Windows)
Framework targeting features; Select a target framework version ... Resolve system and user assembly references; Enable LINQ; See also.
Read more >
Test explorer should allow choosing target framework
In the new SDK project style, we are able to compile a project for multiple target frameworks at once, but this change is...
Read more >
Why am I unable to select a Target Framework in Visual ...
This is when creating a new C# WinForms project. I have tried uninstalling, reinstalling, and seemingly everything I could find online. Target ......
Read more >
NET Framework 5.0 doesn't show up as a target framework
NET Framework 5.0 doesn't show up as a target framework Follow ... Another reason why Rider does not allow selecting .
Read more >
Target Multiple Frameworks in .NET Core 2.x App
To demonstrate this, let's create .NET Core 2.0 console application which can run with .NET Core as well as traditional .NET framework in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found