From dde9b6c5091326012aa15d7b3f9b1f555ecdfe65 Mon Sep 17 00:00:00 2001 From: Ivan Matantsev Date: Fri, 12 Apr 2019 10:20:35 -0700 Subject: [PATCH] put product version insted of version --- src/Microsoft.ML.Core/Data/Repository.cs | 4 +++- test/Microsoft.ML.Functional.Tests/ModelFiles.cs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.ML.Core/Data/Repository.cs b/src/Microsoft.ML.Core/Data/Repository.cs index ab4117c8f6..40d7b7cc47 100644 --- a/src/Microsoft.ML.Core/Data/Repository.cs +++ b/src/Microsoft.ML.Core/Data/Repository.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.IO.Compression; using Microsoft.ML.Internal.Utilities; @@ -304,9 +305,10 @@ public static RepositoryWriter CreateNew(Stream stream, IExceptionContext ectx = Contracts.CheckValueOrNull(ectx); ectx.CheckValue(stream, nameof(stream)); var rep = new RepositoryWriter(stream, ectx, useFileSystem); + var versionInfo = FileVersionInfo.GetVersionInfo(typeof(RepositoryWriter).Assembly.Location); using (var ent = rep.CreateEntry(DirTrainingInfo, "Version.txt")) using (var writer = Utils.OpenWriter(ent.Stream)) - writer.WriteLine(typeof(RepositoryWriter).Assembly.GetName().Version); + writer.WriteLine(versionInfo.ProductVersion); return rep; } diff --git a/test/Microsoft.ML.Functional.Tests/ModelFiles.cs b/test/Microsoft.ML.Functional.Tests/ModelFiles.cs index 78d4b003a9..d7b28b7142 100644 --- a/test/Microsoft.ML.Functional.Tests/ModelFiles.cs +++ b/test/Microsoft.ML.Functional.Tests/ModelFiles.cs @@ -6,6 +6,7 @@ using System.IO; using System.IO.Compression; using System.Linq; +using System.Text.RegularExpressions; using Microsoft.ML.Calibrators; using Microsoft.ML.Data; using Microsoft.ML.Functional.Tests.Datasets; @@ -67,7 +68,7 @@ public void DetermineNugetVersionFromModel() { // The only line in the file is the version of the model. var line = reader.ReadLine(); - Assert.Equal(@"1.0.0.0", line); + Assert.Matches(new Regex(@"(\d+).(\d+)\.(\d+)\.(\d+) \@BuiltBy:(.)* \@SrcCode:(.)*"), line); } } }