Skip to content

.Net: Add ReferenceTrimmer and remove unused references - #13557

Closed
dfederm wants to merge 1 commit into
microsoft:mainfrom
dfederm:feature/reference-trimmer
Closed

.Net: Add ReferenceTrimmer and remove unused references#13557
dfederm wants to merge 1 commit into
microsoft:mainfrom
dfederm:feature/reference-trimmer

Conversation

@dfederm

@dfederm dfederm commented Feb 17, 2026

Copy link
Copy Markdown
Member

Add ReferenceTrimmer to enable detection of unnecessary project, package, and assembly references during build. Remove all unused references identified by ReferenceTrimmer.

Note: Because both ProjectReferences and PackageReferences are transitive, sometimes removing an unused dependency will cause build errors due to missing a dependency that was previously pull in transitively. In these cases, the reference is explicitly added. So despite this change having many added references, it's actually reducing references as those added references were previously underdefined but existing dependencies (due to transitivity).

Disclosure: I own ReferenceTrimmer, but I do think it will be helpful to this repo, as evidenced by the many unused references it was able to identify. Adding it to your repo will help keep the references clean.

@dfederm
dfederm requested a review from a team as a code owner February 17, 2026 10:52
@moonbox3 moonbox3 added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Feb 17, 2026
@github-actions github-actions Bot changed the title Add ReferenceTrimmer and remove unused references .Net: Add ReferenceTrimmer and remove unused references Feb 17, 2026
@dfederm
dfederm force-pushed the feature/reference-trimmer branch from a973231 to 4ca3396 Compare February 17, 2026 11:00
@dfederm
dfederm force-pushed the feature/reference-trimmer branch from 4ca3396 to 2d4efe4 Compare February 17, 2026 11:19
@dfederm
dfederm marked this pull request as draft February 17, 2026 11:27
@dfederm
dfederm force-pushed the feature/reference-trimmer branch from 2d4efe4 to 059e921 Compare February 17, 2026 19:17
@dfederm
dfederm force-pushed the feature/reference-trimmer branch from 059e921 to 6b0849e Compare February 17, 2026 20:07
@dfederm
dfederm marked this pull request as ready for review February 17, 2026 20:25
@dfederm

dfederm commented Mar 4, 2026

Copy link
Copy Markdown
Member Author

Pinging some recent contributors since this has been sitting for a while:
@westey-m, @roji, @SergeyMenshykh, @markwallace-microsoft


<ItemGroup>
<ProjectReference Include="..\Abstractions\Agents.Abstractions.csproj" />
<ProjectReference Include="..\..\SemanticKernel.Core\SemanticKernel.Core.csproj" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of change may be a breaking change for some users. If a user depended on only Agents.Bedrock but also used artifacts from SemanticKernel.Core, it would cause the code not to compile after taking the new version of Agents.Bedrock. This is unfortunate, since cleaning up these references is actually really nice.

@westey-m

westey-m commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Closing this PR, since many of these changes would be potentially breaking, and therefore not something we can do at this stage for Semantic Kernel.

@westey-m westey-m closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants