Version scoped verifier task name - #31
Merged
Merged
Conversation
MSBuild's task registry is keyed by task name alone — not assembly path, identity, or version — and the first UsingTask to claim a name serves every invocation of it in the project. Every SponsorCheck-bundling package ships its own SponsorCheck.dll under the bare name VerifySponsorshipTask, so one copy ran all the verifiers in a consumer project. Once two such packages bundled versions with different task APIs, the build died with MSB4064, pointing at the newer package's targets while naming the older package's DLL. Unpinning AssemblyVersion did not fix this: registration is resolved before assembly identity is consulted. That comment is corrected rather than dropped — per-release AssemblyVersion still matters, and now also feeds the task name. SponsorCheck.csproj now generates VerifySponsorshipTask_<version>, a subclass of VerifySponsorshipTask (hence unsealed), plus a VersionedTaskName.Verify const initialized with nameof so the bundler's substitution cannot drift from the type compiled. Both verifier templates bind it through a new __SC_TASK_NAME__ placeholder. Version separators are sanitized to '_' so prerelease versions stay valid identifiers. BundleSponsorListTask keeps its bare name — a project can only reference one SponsorCheck version, so it cannot collide. Packages published before this change still register the bare name, harmlessly, since it no longer collides with anything newer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.