public override bool Execute() { var task = new UpdateAssemblyInfo(Files, VersionNumber, VersionNumber); task.Execute(); return(true); }
public override bool Execute() { var gitFolder = GitDirFinder.TreeWalkForGitDir(ProjectFolder); if (string.IsNullOrEmpty(gitFolder)) { if (TeamCity.IsRunningInBuildAgent()) //fail the build if we're on a TC build agent { this.LogError("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode"); return(false); } var message = string.Format("No .git directory found in solution path '{0}'. This means the assembly may not be versioned correctly. To fix this warning either clone the repository using git or remove the `GitFlowVersion.Fody` nuget package. To temporarily work around this issue add a AssemblyInfo.cs with an appropriate `AssemblyVersionAttribute`.", ProjectFolder); this.LogWarning(message); return(true); } var versionAndBranch = VersionCache.GetVersion(gitFolder); WriteTeamCityParameters(versionAndBranch); var semanticVersion = versionAndBranch.Version; Version = string.Format("{0}.{1}.{2}", semanticVersion.Major, semanticVersion.Minor, semanticVersion.Patch); FileVersion = string.Format("{0}.{1}.{2}", semanticVersion.Major, semanticVersion.Minor, semanticVersion.Patch); InfoVersion = versionAndBranch.ToLongString(); NugetVersion = NugetVersionBuilder.GenerateNugetVersion(versionAndBranch); this.LogInfo(String.Format("Version number is {0} and InfoVersion is {1}", Version, InfoVersion)); if (Files == null) { return(true); } var task = new UpdateAssemblyInfo(Files, Version, FileVersion); task.Execute(); return(true); }