microsoft / microsoft/vscode-dotnettools
[WebToolsE2E][v11] Creating a Razor Page in ASP.NET Core project causes NETSDK1022 Duplicate 'Content' items error
@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
- OS: Windows x64
- Install the SDK 10.0.401
- Install VS Code insiders - 1.139.0
- Install C#DevKit (public prerelease): 11.0.2 (C#: 2.151.28)
REPRO STEPS
- Open VS Code. > Click "Create .NET Project" > ASP.NET Core Empty
- create folder named Pages > Right-click the Pages folder > Select New .NET File...
- Select Razor Page > Keep the default name Index1 > Enter
- 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.
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.