0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UiPath StudioのPublish時のバージョンの算出方法について

Posted at

UiPath Studio 2018.3、Community Editionだけでなく、商用版もリリースされましたね。

さて、2018.2.xまでは明示的に指定出来なかった UiPath StudioでPublishする際のバージョンですが、 2018.3からはヒトが入力して明示的に指定出来るようになりました。
image.png

この、お客さんに「このバージョンどうやって決まるの?長いんだけど。。」って言われるヤツですね。明示的に指定出来るようになってよかったです。。

ところでこの自動生成される「6826」と「30547」ですが、どうやって出力されてるのかな?と思って調べてみると、、、、

オートメーションプロジェクトの公開について

どうやらここを見ると、

ビルドバージョンとリビジョンバージョンはアルゴリズムに従って生成されます。ビルドの値は、01.01.2000 (2000 年 1 月 1 日) からの経過日数です。リビジョンの値は、GMT の午前 5 時からリリース日時までに経過した秒数です。

なるほど。

計算してみましょう。ちなみに、うえのこのキャプチャは日本時間の 2018/09/09/ 16:58のものです。。

やってみる

GMTの5時から、ビルドバージョン 6826 を経過日数として足して、リビジョンバージョン 30547 を秒数として足せばよいんですね、、。

 static void Main(string[] args)
 {
     int build = 6826;
     int revision = 30547;
     pattern2(build, revision);
 }

 private static void pattern2(int build, int revision)
 {
     TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
     TimeSpan span = tz.BaseUtcOffset;

     // そのタイムゾーン(TimeSpan)の、DateTimeOffset オブジェクト作成
     DateTimeOffset date = new DateTimeOffset(2000, 1, 1, 5, 0, 0, span);

     date = date.AddDays(build).AddSeconds(revision);
     Console.WriteLine("Pattern2: {0}", date.ToString());
 }

こうなるのかな?やってみましょう。。。

Pattern2: 2018/09/09 13:29:07 +00:00
続行するには何かキーを押してください . . .

うん、合いませんね、、。。なんでだろう。。

もすこし調べてみる

も少し調べてみると、、こんなサイトも見つけました。
How to have an auto incrementing version number (Visual Studio)?

てことで再度、やってみましょう。

static void Main(string[] args)
{
    int build = 6826;
    int revision = 30547;

    pattern1(build, revision);

}

private static void pattern1(int build, int revision)
{
    TimeZoneInfo tz = TimeZoneInfo.Local;
    TimeSpan span = tz.BaseUtcOffset;

    // そのタイムゾーン(TimeSpan)の、DateTimeOffset オブジェクト作成
    DateTimeOffset date = new DateTimeOffset(2000, 1, 1, 0, 0, 0, span);

    date = date.AddDays(build).AddSeconds(revision * 2);
    Console.WriteLine("Pattern1: {0}", date.ToString());

}

実行結果は、、、

Pattern1: 2018/09/09 16:58:14 +09:00
続行するには何かキーを押してください . . .

なんでかよく分かりませんが、一致しました。。。。
Visual Studio界隈のお作法?なんですかね。

わかるひとおしえてくださーい。。。

以上、お疲れ様でした。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?