private static Version GetAssemblyVersion(Version version, VersionOptions versionOptions)
        {
            var assemblyVersion = versionOptions?.AssemblyVersion?.Version ?? new System.Version(version.Major, version.Minor);

            assemblyVersion = new System.Version(
                assemblyVersion.Major,
                assemblyVersion.Minor,
                versionOptions?.AssemblyVersion?.Precision >= VersionOptions.VersionPrecision.Build ? version.Build : 0,
                versionOptions?.AssemblyVersion?.Precision >= VersionOptions.VersionPrecision.Revision ? version.Revision : 0);
            return(assemblyVersion.EnsureNonNegativeComponents(4));
        }
Exemplo n.º 2
0
        private static Version GetAssemblyVersion(Version version, VersionOptions versionOptions)
        {
            // If there is no repo, "version" could have uninitialized components (-1).
            version = version.EnsureNonNegativeComponents();

            var assemblyVersion = versionOptions?.AssemblyVersionOrDefault.Version ?? new System.Version(version.Major, version.Minor);
            var precision       = versionOptions?.AssemblyVersionOrDefault.PrecisionOrDefault;

            assemblyVersion = new System.Version(
                assemblyVersion.Major,
                precision >= VersionOptions.VersionPrecision.Minor ? assemblyVersion.Minor : 0,
                precision >= VersionOptions.VersionPrecision.Build ? version.Build : 0,
                precision >= VersionOptions.VersionPrecision.Revision ? version.Revision : 0);
            return(assemblyVersion.EnsureNonNegativeComponents(4));
        }