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

Set Version and PackageVersion to a default value #232

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

kzu
Copy link
Member

@kzu kzu commented Feb 9, 2023

It's not entirely intuitive that you install GitInfo and by default "nothing happens", as in, you get new code from ThisAssembly, but otherwise, no versioning changes happen. This might be counterintuitive to newcomers, who might just care to get something (a sensible default) going, before investing more in customizing GitInfo.

This is how MinVer does it (provided there's a version tag in the repository) and it's quite intuitive.

The way we do it here should be mostly backwards compat because:

  1. Users leveraging assembly-version attributes will already have disabled .NET SDK assembly attribute generation
  2. Users leveraging MSBuild targets to do this would be following the recommended guidance of creating a target that runs before specific targets, not as InitialTargets

We make our version-setting target run as an inital target, which may have a minor impact on initial build perf, but but shouldn't be a problem since the same targets are run for DTB anyway (if you make them run before
GetAssemblyVersion, which also runs before
BeforeCompile and CoreCompile in the SDK).

By being an initial target, we allow for existing customization in pretty much any target, prevail our own one, which becomes just a default.

Even so, we check for GitVersion=false as an escape hatch for users who may encounter unforseen broken scenarios.

It's not entirely intuitive that you install GitInfo and by default
"nothing happens", as in, you get new code from ThisAssembly,
but otherwise, no versioning changes happen. This might be
counterintuitive to newcomers, who might just care to get
something (a sensible default) going, before investing more
in customizing GitInfo.

This is how MinVer does it (provided there's a version tag
in the repository) and it's quite intuitive.

The way we do it here should be mostly backwards compat
because:
1. Users leveraging assembly-version attributes will already
    have disabled .NET SDK assembly attribute generation
2. Users leveraging MSBuild targets to do this would be
    following the recommended guidance of creating a target
    that runs before specific targets, not as InitialTargets

We make our version-setting target run as an inital target,
which may have a minor impact on initial build perf, but
but shouldn't be a problem since the same targets are
run for DTB anyway (if you make them run before
GetAssemblyVersion, which also runs before
BeforeCompile and CoreCompile in the SDK).

By being an initial target, we allow for existing customization
in pretty much any target, prevail our own one, which becomes
just a default.

Even so, we check for GitVersion=false as an escape hatch for
users who may encounter unforseen broken scenarios.
@kzu kzu added the enhancement label Feb 9, 2023
@kzu kzu merged commit ca66be5 into main Feb 9, 2023
@kzu kzu deleted the dev/gitversion branch February 9, 2023 15:30
@devlooped devlooped locked and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant