microsoft / microsoft/vscode-dotnettools

[BUG] Renaming a Project from the Solution Explorer strips <ProjectReference> XML attributes

Open
#1,102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the Issue

If you rename a .csproj from the Solution Explorer it will strip any XML attributes on the project reference. For example, if I rename a Source Generator that was referenced like this:

  <ItemGroup>
    <ProjectReference Include="SourceGen\SourceGenOld.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
  </ItemGroup>

It will replace it with this:

  <ItemGroup>
    <ProjectReference Include="SourceGen\SourceGenNew.csproj" />
  </ItemGroup>

Which will stop the Source Generator from running, in this scenario.

Steps To Reproduce
  1. Open a solution with at least two projects
  2. Have one project reference the other, and include XML attributes on the ProjectReference (for example a source generator that requires extra attributes)
  3. Rename the referenced project from within the C# DevKit Solution Explorer
  4. Notice the reference losing its XML attributes
Expected Behavior

The <ProjectReference> should not lose any of the XML attributes it had before the rename.

Environment Information
  • Linux (Fedora 40)
  • C# Dev Kit v1.4.29
  • VS Code v1.89.0

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.

Research direction

Start by reproducing the rename from the C# Dev Kit Solution Explorer with a ProjectReference that has OutputItemType and ReferenceOutputAssembly attributes. Trace the rename operation and its project-reference update path; no source files or tests are named in the issue. Done means renaming the project changes only the Include path and preserves the existing XML attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, vscode
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.