code_junkie

SVN Revision Version in .NET Assembly w/ out CC.NET

Nov 10th, 2011
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #define MAJORVER 4
  2. #define MINORVER 23
  3. #define SOURCEVER 965
  4.  
  5. using System;
  6. using Microsoft.Build.Framework;
  7. using Microsoft.Build.Utilities;
  8. using DotSVN.Common;
  9. using DotSVN.Common.Entities;
  10. using DotSVN.Common.Util;
  11. using DotSVN.Server.RepositoryAccess;
  12.  
  13. namespace GetSVNVersion
  14. {
  15. public class GetRevision : Task
  16. {
  17. [Required]
  18. public string Repository { get; set; }
  19. [Output]
  20. public string Revision { get; set; }
  21.  
  22. public override bool Execute()
  23. {
  24. ISVNRepository repo;
  25. bool connected = true;
  26. try
  27. {
  28. repo = SVNRepositoryFactory.Create(new SVNURL(Repository));
  29. repo.OpenRepository();
  30. Revision = repo.GetLatestRevision().ToString();
  31. Log.LogCommandLine(Repository + " is revision " + Revision);
  32. repo.CloseRepository();
  33. }
  34. catch(Exception e)
  35. {
  36. Log.LogError("Error retrieving revision number for " + Repository + ": " + e.Message);
  37. connected = false;
  38. }
  39. return connected;
  40. }
  41. }
  42. }
Add Comment
Please, Sign In to add comment