Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build utils to simplify local package sharing #77822

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tmat
Copy link
Member

@tmat tmat commented Mar 25, 2025

Automatically deletes package built by a project from NuGet cache. This allows build from another repo to use Roslyn package output dir as a package source without manually cleaning up packages for every Roslyn change.

Imports Settings.user.props from Settings.props to allow devs to locally override properties, such as VSSDKTargetPlatformRegRootSuffix.
Adds *.user.props to .gitignore to keep it local.

@tmat tmat requested a review from a team as a code owner March 25, 2025 23:13
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 25, 2025
@tmat
Copy link
Member Author

tmat commented Mar 25, 2025

@genlu @jaredpar ptal

Copy link
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -286,6 +286,14 @@
<Warning Condition="'%(RestrictedInternalsVisibleTo.Partner)' == '' and '%(RestrictedInternalsVisibleTo.Namespace)' == ''" Text="RestrictedInternalsVisibleTo items must specify the 'Partner' or 'Namespace' attribute. Target assembly: %(Identity)" />
</Target>

<!--
Deletes the package built by this project from local NuGet cache (if present).
Allows refreshing locally built Roslyn packages consumed by another local repo.
Copy link
Member

Choose a reason for hiding this comment

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

Alternative (I think a better one because it works in other repos and maybe more scenarios) is to specify VersionSuffix when packing, I usually do

.\build.cmd -pack /p:VersionSuffix=$(git rev-parse --short HEAD)

That produces a uniquely versioned package.

Copy link
Member Author

@tmat tmat Mar 26, 2025

Choose a reason for hiding this comment

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

You'd need to keep updating the version in the other repository with every build though. It also requires building from command line - which is another extra step.

Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

Burn this with fire. Do not touch my NuGet folder without explicit permission.

Whatever you are trying to do, there are ways to do it. This is not one of those ways.

@tmat
Copy link
Member Author

tmat commented Mar 27, 2025

@sharwell
I don't see why this is a problem. It only affects packages built from Roslyn of the very specific version that you're currently building, i.e. "14.0.0-dev".

@tmat
Copy link
Member Author

tmat commented Mar 27, 2025

Specifically, deleting a package version from the cache doesn't break anything. If a build needs that version it will redownload the package from the sources.
The only way how a locally built dev version of Roslyn package can be in the nuget cache is when you set package source of other local repo to Roslyn packages output dir. Next time this repo builds the cache is repopulated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants