microsoft / microsoft/vscode-dotnettools

[WebToolsE2E][v11] Creating a Razor Page in ASP.NET Core project causes NETSDK1022 Duplicate 'Content' items error

Open
#3,540 1 comment 0 reactions 1 assignee View on GitHub

@genlu is already working on this.

Since Sep 17, 2026.

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

Description

REGRESSION INFO: Not Repro on V3 Stable: CDK: 3.40.201; C#: 2.151.28
INSTALL STEPS

  1. OS: Windows x64
  2. Install the SDK 10.0.401
  3. Install VS Code insiders - 1.139.0
  4. Install C#DevKit (public prerelease): 11.0.2 (C#: 2.151.28)

REPRO STEPS

  1. Open VS Code. > Click "Create .NET Project" > ASP.NET Core Empty
  2. create folder named Pages > Right-click the Pages folder > Select New .NET File...
  3. Select Razor Page > Keep the default name Index1 > Enter
  4. Start new instance

Workaround:
Include this on xx.csproj inside <PropertyGroup>
<EnableDefaultContentItems>false</EnableDefaultContentItems>

ACTUAL After creating a Razor Page (Index1) under the Pages folder, project detection fails with NETSDK1022: Duplicate 'Content' items were included. Project cannot run.

Image

Logs:
Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Pages\Hero.cshtml' [C:\Users\v-cimperial\WebApplication3\WebApplication3\WebApplication3.csproj]

EXPECTED The Razor Page should be created successfully with no errors, and the project should run successfully.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.