Guest User

Untitled

a guest
Oct 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. var result = new DateTime(2000, 1, 1);
  2. result = result.AddDays(buildNumber);
  3. result = result.AddSeconds(revision * 2);
  4.  
  5. <major version>.<minor version>.<build number>.<revision>
  6.  
  7. <major version>.<minor version>.<build> number>.<revision>
  8.  
  9. <ItemGroup>
  10. <RegexTransform Include="$(SolutionRoot)CommonAssemblyInfo.cs">
  11. <Find>(?<major>d+).(?<minor>d+).d+.(?<revision>d+)</Find>
  12. <ReplaceWith>$(BUILD_NUMBER)</ReplaceWith>
  13. </RegexTransform>
  14. </ItemGroup>
  15.  
  16. msbuild myBuild.proj /p:Configuration="%config%" /p:build_number="%version%"
  17.  
  18. int revision = (int)time.TimeOfDay.TotalSeconds / 2;
  19.  
  20. // 24 * 60 * 60 / 2 = 43200 < 65535
  21. Debug.Assert(revision < ushort.MaxValue);
  22.  
  23. // ...
  24.  
  25. TimeSpan days = time.Date - new DateTime(2000, 1, 1);
  26. int build = Math.Min(ushort.MaxValue, (int)days.TotalDays);
  27.  
  28. return new Version(pattern.Major, pattern.Minor, (ushort)build, (ushort)revision);
Add Comment
Please, Sign In to add comment