Skip to content

Set spectre.console version properties#1574

Merged
NikolaMilosavljevic merged 1 commit intodotnet:mainfrom
NikolaMilosavljevic:spectre.console.versions
Feb 13, 2026
Merged

Set spectre.console version properties#1574
NikolaMilosavljevic merged 1 commit intodotnet:mainfrom
NikolaMilosavljevic:spectre.console.versions

Conversation

@NikolaMilosavljevic
Copy link
Copy Markdown
Member

Fixes: dotnet/source-build#5466

Spectre.console repo produces assembly with AssemblyVersion set to 0.0.0.0. When building in this repo, MinVer package will be used for automatic versioning. It sets various version properties according to https://github.com/adamralph/minver?tab=readme-ov-file#version-numbers

Since AssemblyVersion gets set by MinVer target/task, SDK's GetAssemblyVersion target gets skipped.

When building in SBRP repo, or in VMR, we build Spectre.Console with a custom command line as specified in https://github.com/dotnet/source-build-reference-packages/blob/main/src/externalPackages/projects/spectre-console.proj

We did not want to include additional dependent packages, like MinVer so we had set UseBuildTimeTools to false which excludes additional external package dependencies: https://github.com/spectreconsole/spectre.console/blob/e097281ca8a50268b1022453fe6efd9112123a28/src/Directory.Build.props#L53-L54

The fix is to explicitly set AssemblyVersion. Since setting this property would cause the build to skip GetAssemblyVersion target, we are also setting FileVersion and InformationalVersion properties that would have been set in GetAssemblyVersion target.

@MichaelSimons
Copy link
Copy Markdown
Member

@NikolaMilosavljevic - Have your reached out to spectre-console? Why not upstream a fix so they set the AssemblyVersion?

@NikolaMilosavljevic
Copy link
Copy Markdown
Member Author

@NikolaMilosavljevic - Have your reached out to spectre-console? Why not upstream a fix so they set the AssemblyVersion?

I have not reached out yet. They do indirectly set the AssemblyVersion since they consume MinVer package. We can't consume the same package so we need to set the version directly.

@MichaelSimons
Copy link
Copy Markdown
Member

@NikolaMilosavljevic - Have your reached out to spectre-console? Why not upstream a fix so they set the AssemblyVersion?

I have not reached out yet. They do indirectly set the AssemblyVersion since they consume MinVer package. We can't consume the same package so we need to set the version directly.

I understand why we can't use MinVer. Can you expand on They do indirectly set the AssemblyVersionsince they consumeMinVer package. If this is the case, why is the version from the MSFT build showing 0.0.0.0?

@NikolaMilosavljevic
Copy link
Copy Markdown
Member Author

NikolaMilosavljevic commented Feb 13, 2026

@NikolaMilosavljevic - Have your reached out to spectre-console? Why not upstream a fix so they set the AssemblyVersion?

I have not reached out yet. They do indirectly set the AssemblyVersion since they consume MinVer package. We can't consume the same package so we need to set the version directly.

I understand why we can't use MinVer. Can you expand on They do indirectly set the AssemblyVersionsince they consumeMinVer package. If this is the case, why is the version from the MSFT build showing 0.0.0.0?

In Spectre.console repo build, since MinVer package is included, a MinVer target will run. That target sets AssemblyVersion to 0.0.0.0, i.e. {MinVerMajor}.0.0.0, since MinVerMajor is 0.

Of course, MSFT build consumes the package from nuget.org, produced by spectre.console repo build. That's why we get the assembly with version 0.0.0.0.

In source-build, since we do not have MinVer package and do not, yet, set AssemblyVersion property, GetAssemblyVersion target runs, and sets the AssemblyVersion to 0.54.0.0 - the file version.

@NikolaMilosavljevic NikolaMilosavljevic merged commit cc90bb4 into dotnet:main Feb 13, 2026
4 checks passed
@mthalman
Copy link
Copy Markdown
Member

/backport to release/10.0

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spectre.Console assembly version mismatch

4 participants