What is the best way to use assembly versioning attributes?

后端 未结 8 986
灰色年华
灰色年华 2021-02-04 08:35

The AssemblyVersion and AssemblyFileVersion attributes are the built-in way of handling version numbers for .NET assemblies. While the framework provides the ability to have the

相关标签:
8条回答
  • 2021-02-04 09:17

    We use the versioning from subversion and have the buildscripts update the assembly version info, so source checkins control versioning.

    0 讨论(0)
  • 2021-02-04 09:26

    We tend to embed the release (or build) date into the assembly. For example if built today the version would be "2008.10.06" (the build script updates it).

    0 讨论(0)
  • 2021-02-04 09:29

    On my current project, we use the Subversion revision number as the least significant (build) part of the version number, and we use a Nant script to create the project AssemblyInfo file. We use the same version number for both the AssemblyVersion and AssemblyFileVersion attributes. (The other three parts are major.minor.point, where major.minor will be incremented every time there's a database schema change, and point is incremented for each release.)

    We started out with the build number being simply incremented, but that required that the version file be checked in for every build, and caused conflicts when merging. When that proved unworkable, we started using CruiseControl.NET to generate the build number, but that made it difficult to reproduce specific builds manually. Eventually we went to the current (Subversion-revision) scheme.

    Note: Unfortunately with .NET, it is not possible to perfectly recreate a build from a past revision, because the .NET compilers encode the current timestamp into the object file when compiling. Every time you compile the same code, you get a different object file.

    0 讨论(0)
  • 2021-02-04 09:29

    Our build scripts inject the changeset number from TFS into the version. That way we know exactly what checkins are in the build.

    0 讨论(0)
  • 2021-02-04 09:31

    The AssemblyVersionAttribute is part of an assembly's identity. Changing that means it is a different assembly and programs linking to that assembly need to be recompiled/linked or a version policy need to be applied. We didn't find that apealing so we choose to only increase the AssemblyFileVersion for each hotfix and only change the AssemblyVersion for each major release. We are aware that this decision brings back some of the win32 dll hell. We increase the AssemblyFileVersion for each build and label/tag the version control system with that version so we know from what source the binary came.

    0 讨论(0)
  • 2021-02-04 09:32

    We have our CruiseControl.NET build server embed the perforce changelist number into the AssemblyFileVersion — this lets us track back to the source code for any assembly built by the build server. (We always build from the main branch.)

    For assemblies that customers will be referencing we leave the AssemblyVersion constant unless there are breaking changes, in which case we increment the version to ensure that customer code gets re-built against the new version.

    0 讨论(0)
提交回复
热议问题