コード例 #1
0
        public AssemblyInfoParseResult Parse()
        {
            if (CreateAssemblyInfo && Path != null)
            {
                CreateAssemblyInfoOnDisk(Path);
            }
            var parser = new AssemblyInfoParser(FileSystem, Environment);

            return(parser.Parse(Path));
        }
コード例 #2
0
        public void PatchAllAssemblyInfo(VersionResult versionInfo, string copyrightText)
        {
            var parser        = new AssemblyInfoParser(_fileSystem, _environment);
            var creator       = new AssemblyInfoCreator(_fileSystem, _environment, _log);
            var assemblyFiles = _globber.GetFiles("./**/AssemblyInfo.cs");

            foreach (var file in assemblyFiles)
            {
                _log.Verbose($"Possibly file to patch:{file}");
                if (file.ToString().Contains("packages/"))
                {
                    continue;
                }
                var assemblyInfo = parser.Parse(file);

                string rootVersion = versionInfo.RootVersion;
                //on AppVeyor, if it is a PullRequest and "pull_requests: do_not_increment_build_number" is true, it will make up a build like 1.0.2-fisiek
                //It does this because it requires unique version numbers.
                //So, what is in RootVersion has this 'prerelease' tag of 'fisiek' or whatever on it.  This is not valid when versioning assembiles!
                //we of course are not going to publish prereleases to nuget, so just make up any version for this.

                //if do_not_increment_build_number is false, then the version does NOT contain the extra tag and it does not matter.
                //of course we do not know if this is true or false.  So we will just look...
                if (IsPullRequest && rootVersion.Contains("-"))
                {
                    rootVersion = "1.0.1";
                }

                _log.Information($"Creating File Version:{rootVersion} Info Version:{versionInfo.FullVersion} for {file} ");

                creator.Create(file, new AssemblyInfoSettings
                {
                    Product              = assemblyInfo.Product,
                    Version              = rootVersion,
                    FileVersion          = rootVersion,
                    InformationalVersion = versionInfo.FullVersion,
                    Copyright            = string.Format(copyrightText, DateTime.Now.Year)
                });
            }
        }
コード例 #3
0
        public AssemblyInfoParseResult Parse(FilePath filePath)
        {
            var parser = new AssemblyInfoParser(FileSystem, Environment);

            return(parser.Parse(filePath));
        }