A file named 'Directory.Build.targets' is already included in 'ConsoleApp1'

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp, vscode

Research direction

Start with the New .NET File command in the C# Dev Kit flow and reproduce the issue by adding MSBuild Directory.Build.props and Directory.Build.targets to a C# Console App in sequence. Done means both files can be selected and added together without the duplicate-file message; no source files or tests are named in the issue.

Written by the indexing model from the issue text.

Description

bug

1.Not a regression.
2.Low priority.

Describe the issue

If adding either the MSBuild Directory.Build.props file or the MSBuild Directory.Build.targets file first, you'll get a message saying it already exists when you try to add the other one.
Image

Image
Collect logs

csdevkit-logs-2026-07-31T05-50-25.zip

Steps to reproduce

1.Create a C# Console App.
2.Right-click the project folder->New .NET File->Select MSBuild Directory.Build.props file and MSBuild Directory.Build.targets files to add.

Expected behavior

These two files can be added together.
Image

Environment information

.NET Install Tool: Pre-release 3.1.0
C# Dev Kit Extension: Pre-release v3.27.234
C# Extension: Pre-release v2.147.94
.NET SDKs:  11.0.100-preview.6.26359.118
VSCode Insiders: 1.132.0
Platform: Windows X64 

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 Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.