<TargetFrameworks> (plural) with custom MSBuild property from Directory.Build.props causes project to fail loading in IntelliSense

Open
#3,154 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
csharp, vscode

Research direction

Reproduce with Directory.Build.props and MyProject.csproj, then open a .cs file in VS Code and compare plural TargetFrameworks using the custom property with the literal and singular cases. Inspect the C# Dev Kit project-loading and IntelliSense path; done means project and referenced types resolve without CS0246 errors while dotnet build continues to succeed.

Written by the indexing model from the issue text.

Description

area-project-cps

Type: Bug

Issue Description

When a project uses <TargetFrameworks> (plural) and the TFM value is a custom MSBuild property defined in Directory.Build.props, C# Dev Kit fails to load the project correctly. All types from the project and its project references become invisible to IntelliSense, producing CS0246 errors throughout.

Steps to Reproduce

  1. Create Directory.Build.props at repo root:
<PropertyGroup>
  <MyWindowsVersion>net10.0-windows</MyWindowsVersion>
</PropertyGroup>
  1. Create MyProject.csproj:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>$(MyWindowsVersion)</TargetFrameworks>
    <UseWPF>true</UseWPF>
  </PropertyGroup>
</Project>
  1. Open in VS Code with C# Dev Kit, open any .cs file in the project

Expected Behavior

Project loads correctly. Types resolve, no errors.

Actual Behavior

Project fails to load correctly in IntelliSense. All types from the project and its project references are invisible, resulting in CS0246 errors throughout. dotnet build succeeds — this is an IntelliSense-only failure.

Element Value Loads correctly
<TargetFrameworks> plural custom property
<TargetFrameworks> plural literal net10.0-windows
<TargetFramework> singular custom property

Workaround: use singular <TargetFramework>.

Related: dotnet/roslyn#39724, dotnet/roslyn#78144

Logs

C# log shows Successfully completed load even when the project fails to resolve types — no failure is logged at this level.

Environment Information

  • VSCode: 1.122.0
  • C# Extension: 2.140.8
  • C# Dev Kit: 3.20.199
  • Using OmniSharp: false
  • .NET SDK: 10.0.300

Extension version: 3.20.199
VS Code version: Code 1.122.0 (6a49527b96e326fe62fbdb56f60e16877c9aa724, 2026-05-27T14:03:01-07:00)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12900H (20 x 2918)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x46a6 [Intel(R) Iris(R) Xe Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.7077 ACTIVE
GPU1: VENDOR= 0x10de, DEVICE=0x25b9 [NVIDIA RTX A1000 Laptop GPU], DRIVER_VERSION=32.0.15.7344
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8246
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.69GB (39.91GB free)
Process Argv --crash-reporter-id c75fc92f-81eb-45dd-8a76-059ea4ea7be1
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
b6b4d950:31327385
6abeh943:31336334
envsactivate1:31505457
cloudbuttont:31379625
3efgi100_wstrepl:31403338
55ia6109:31457054
ec5jj548:31422691
cp_cls_c_966_ss:31454199
inlinechat_v2_hd992725:31505030
4je02754:31466945
c3h7c220:31478652
ge8j1254_inline_auto_hint_haiku:31490510
38bie571_auto:31478677
cp_cls_c_1081:31454833
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_control1:31471004
46204921:31447328
control_6dc23131:31520950
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
89g7j272:31518289
7e187181:31503455
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
ddid_c:31478207
hmra_i5g22:31518061
getcmakediagnosticsoff:31489825
7df3h592:31512476
pro_large_t:31499376
cp_cls_t_1082:31516087
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_c_632:31517842
b1ei0813:31506238
56dj4588:31512888
cg448276_tst_on:31514358
32d76977:31512328
ha629193:31508444
nes-charagree-0:31521369
539gd155_c:31506875
a1ije391_t:31515488
api_cot_ctrl:31513533
prpt_lrg:31518466
61138546:31518536

Dominant language
No language data
Stars
321
Forks
54
Avg merge
2d 19h
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-dotnettools

All issues in microsoft/vscode-dotnettools

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.