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

Update AssemblyInfo.cs option #23

Closed
JakeGinnivan opened this issue Oct 27, 2013 · 14 comments
Closed

Update AssemblyInfo.cs option #23

JakeGinnivan opened this issue Oct 27, 2013 · 14 comments
Milestone

Comments

@JakeGinnivan
Copy link
Owner

No description provided.

@robdmoore
Copy link
Contributor

+1

@robdmoore
Copy link
Contributor

Also, I'll probably trry using TeamCity's built-in option for this since the variables will be available from TC :)

@SimonCropp
Copy link

do u guys want me to send a PR with same approach used in GitFlowVersion?

@robdmoore
Copy link
Contributor

I tried using TeamCity's built-in option last night - unfortunately it executes it before all build steps so the environment variables aren't set at that point. I ended up using MSBuild tasks.

How does GitFlowVersion do it @SimonCropp?

@SimonCropp
Copy link

injects a temp cs file (containing the attribute) into the build pipeline

https://github.com/Particular/GitFlowVersion/blob/master/GitFlowVersionTask/NugetAssets/GitFlowVersionTask.targets
https://github.com/Particular/GitFlowVersion/blob/master/GitFlowVersionTask/UpdateAssemblyInfo.cs

has the advantage of also working outside the build server

@robdmoore
Copy link
Contributor

Wow that's really clever - nice one!

This is what I ended up doing with ChameleonForms:

  1. https://github.com/MRCollective/ChameleonForms/blob/master/Build.proj
  2. On CI server I execute it using MSBuild with the following parameters /p:Platform="Any CPU" /p:Version="%system.GitHubFlowVersion.AssemblySemVer%" /p:FileVersion="%system.GitHubFlowVersion.FourPartVersion%" /p:InformationalVersion="%system.GitHubFlowVersion.FullSemVer%"

@sgryphon
Copy link

I like how FourPartVersion is being used for the FileVersion (and FullSemVer for the InformationalVersion), but don't think that the AssemblyVersion should include the Patch number.

Under SemVer rules, changes in the Patch number can only be for backwards compatible bug fixes, which means that the assemblies must be version compatible, i.e. version 1.2.3.0 must be compatible with 1.2.4.0; in other words from the AssemblyVersion point of view both should be the same (i.e. both 1.2.0.0).

For example, you can see this in the .NET Framework assemblies (in the GAC), where the AssemblyVersion is always version 3.5.0.0 (or whatever the major/minor version is), whereas the file version is the full four part number (e.g. 3.5.30729.7903) and changes every hotfix / KB update.

Particularly with strong naming, it would be annoying to have to change (or use binding redirects) just for a patch update.

Even for minor updates it is debatable if the assembly version needs to be changed, as they should also always be backwards compatible. i.e. under SemVer rules version 1.5.0.0 must be usable by a client that is expecting 1.2.3.0 (although it may have new functionality).

If this is implemented, I suggest a choice of assembly version between major only or major + minor (but never including the patch number).

Of course, this can be created by using the correct variables, but I think GitHubFlowVersion_AssemblySemVer is currently a bit misleading as it includes the patch number.

@robdmoore
Copy link
Contributor

I agree - that is a confusing name; especially given we are actually trying in some ways to be .NET agnostic.

The GitFlowVersion code that Simon included above does what you suggest with the assembly version, except it automatically detects if you are signing the assembly and makes the choice for you (include minor if not signing, don't otherwise). This seems to make sense.

Re: using the current assembly version for mine - yeah I was tossing up with using major.minor, but given this was a single variable rather than two I erred on the side of laziness. If we provide a built-in way of setting the assembly info then I agree with what you are suggesting / what GitFlowVersion does.

I'm sure jake will weigh in with his thoughts too (possibly after his crazy week at MVP Summit though :p

@SimonCropp
Copy link

@robdmoore so that was a yes to a PR ?

@robdmoore
Copy link
Contributor

Yes from my point of view. Not sure about @JakeGinnivan :P

@JakeGinnivan
Copy link
Owner Author

I was planning to just look for all assemblyinfo.cs files in the repo and update (like teamcity). GithubFlowVersion works at repo level, not project level like GitFlowVersion

@JakeGinnivan
Copy link
Owner Author

Guys, could you take a look at #34, not sure the targets approach which @SimonCropp is using fits that well with the way GitHubFlowVersion works.

Also, does this project need a better name?

@SimonCropp
Copy link

@JakeGinnivan so what approach did u go with? is it documented somehwhere?

@JakeGinnivan
Copy link
Owner Author

@SimonCropp have updated readme with information about it. Check the FAQ section

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

No branches or pull requests

4 participants