Skip to content

Commit

Permalink
Fix regex to recognize prerelease version string
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasvajk committed Apr 17, 2024
1 parent 9926c81 commit 5a5fc79
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,10 @@ private RestoreResult TryRestorePackageManually(string package, string? nugetCon
if (!res.Success && tryPrereleaseVersion && res.HasNugetNoStablePackageVersionError)
{
logger.LogDebug($"Failed to restore nuget package {package} because no stable version was found.");
try
{
TryChangePackageVersion(tempDir.DirInfo, "*-*");
TryChangePackageVersion(tempDir.DirInfo, "*-*");

res = dotnet.Restore(new(tempDir.DirInfo.FullName, missingPackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: false, PathToNugetConfig: nugetConfig, ForceReevaluation: true));
return res;
}
finally
res = dotnet.Restore(new(tempDir.DirInfo.FullName, missingPackageDirectory.DirInfo.FullName, ForceDotnetRefAssemblyFetching: false, PathToNugetConfig: nugetConfig, ForceReevaluation: true));
if (!res.Success)
{
TryChangePackageVersion(tempDir.DirInfo, "*");
}
Expand Down Expand Up @@ -729,7 +725,7 @@ private IEnumerable<string> GetFeeds(Func<IList<string>> getNugetFeeds)
[GeneratedRegex(@"<TargetFramework>.*</TargetFramework>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
private static partial Regex TargetFramework();

[GeneratedRegex(@"Version=""[*|*-*]""", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
[GeneratedRegex(@"Version=""(\*|\*-\*)""", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
private static partial Regex PackageReferenceVersion();

[GeneratedRegex(@"^(.+)\.(\d+\.\d+\.\d+(-(.+))?)$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline)]
Expand Down

0 comments on commit 5a5fc79

Please sign in to comment.