Skip to content

Fix the generator building twice#81950

Merged
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:fix-generator-building-twice
Jan 9, 2026
Merged

Fix the generator building twice#81950
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:fix-generator-building-twice

Conversation

@jasonmalinowski
Copy link
Member

This explicit SetTargetFramework would have been necessary when IntegrationTests.csproj targeted a TFM which wouldn't support a netstandard2.0 reference. Since we're consuming this through a ProjectReference, MSBuild will try to validate that the consumed reference is compatible with our TFM, but by default won't realize that if we're actually outputting this as an Analyzer type it won't actually matter.

This is causing overbuilding though and since this project now targets only netstandard2.0 compatible TFMs, we can just drop this.

Fixes dotnet/dotnet#4121

This explicit SetTargetFramework would have been necessary when
IntegrationTests.csproj targeted a TFM which wouldn't support a
netstandard2.0 reference. Since we're consuming this through a
ProjectReference, MSBuild will try to validate that the consumed
reference is compatible with our TFM, but by default won't realize
that if we're actually outputting this as an Analyzer type it won't
actually matter.

This is causing overbuilding though and since this project now targets
only netstandard2.0 compatible TFMs, we can just drop this.

Fixes dotnet/dotnet#4121
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner January 9, 2026 20:17
@jasonmalinowski jasonmalinowski self-assigned this Jan 9, 2026
@jasonmalinowski jasonmalinowski merged commit 2b9d816 into dotnet:main Jan 9, 2026
27 checks passed
@jasonmalinowski jasonmalinowski deleted the fix-generator-building-twice branch January 9, 2026 22:20
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 9, 2026
@dibarbet
Copy link
Member

/backport to release/dev18.3

@github-actions
Copy link
Contributor

Started backporting to release/dev18.3 (link to workflow run)

dibarbet added a commit that referenced this pull request Jan 12, 2026
Backport of #81950 to release/dev18.3

/cc @dibarbet @jasonmalinowski

## Customer Impact

## Regression

- [ ] Yes
- [ ] No

[If yes, specify when the regression was introduced. Provide the PR or
commit if known.]

## Testing

[How was the fix verified? How was the issue missed previously? What
tests were added?]

## Risk

[High/Medium/Low. Justify the indication by mentioning how risks were
measured and addressed.]
@davidwengier davidwengier modified the milestones: Next, 18.4 Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overbuilding in roslyn - Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator.csproj packed twice with different global properties

4 participants