Parse() 공개 정적인 메소드

Creates a NuGetVersion from a string representing the semantic version.
public static Parse ( string value, bool preserveMissingComponents = false ) : SemanticVersion
value string
preserveMissingComponents bool
리턴 SemanticVersion
예제 #1
0
 public void Default(string packageVersion)
 {
     try
     {
         SemanticVersion.Parse(packageVersion);
         defaultVersion = packageVersion;
     }
     catch (ArgumentException)
     {
         if (packageVersion.Contains(":"))
         {
             throw new ArgumentException("Invalid package version format. Use the package parameter if you need to specify the step name and version.");
         }
         throw;
     }
 }
예제 #2
0
        public void Add(string stepNameOrPackageId, string packageReferenceName, string packageVersion)
        {
            // Double wild card == default value
            if (stepNameOrPackageId == WildCard && packageReferenceName == WildCard)
            {
                Default(packageVersion);
                return;
            }

            var key = new PackageKey(stepNameOrPackageId, packageReferenceName ?? WildCard);

            if (stepNameToVersion.TryGetValue(key, out var current))
            {
                var newVersion     = SemanticVersion.Parse(packageVersion);
                var currentVersion = SemanticVersion.Parse(current);
                if (newVersion < currentVersion)
                {
                    return;
                }
            }

            stepNameToVersion[key] = packageVersion;
        }