dotnet / dotnet/msbuild

ProjectGraph does not load added projects

Open
#12,064 6 comments 0 reactions 0 assignees View on GitHub
Area: Static Graph Partner request Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 19h
Merged PRs (30d)
135

Description

### Issue Description

Repro:
1) Create ProjectGraph instance
2) Add ProjectReference to a new project
3) Create another ProjectGraph instance

The second instance does not include the new project.

### Steps to Reproduce

Unzip [Repro.zip](https://github.com/user-attachments/files/20887754/Repro.zip),
update path to SDK in `Program.cs`: `MSBuildLocator.RegisterMSBuildPath(@"C:\Program Files\dotnet\sdk\9.0.301");` if needed and `dotnet run` from `Repro` directory.

### Expected Behavior

```
Loaded projects:
pp\App.csproj
Loaded projects:
App\App.csproj
Lib\Lib.csproj
```

### Actual Behavior

```
Loaded projects:
pp\App.csproj
Loaded projects:
App\App.csproj
```

### Analysis

_No response_

### Versions & Configurations

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the attached Repro directory by updating the SDK path in Program.cs, then run dotnet run to reproduce the ProjectGraph and ProjectReference behavior. Trace how the second ProjectGraph instance loads projects and verify it includes both App\App.csproj and Lib\Lib.csproj, matching the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.