diff --git a/eng/dependabot/Packages.props b/eng/dependabot/Packages.props
index ad78da640dd..757a4c999ab 100644
--- a/eng/dependabot/Packages.props
+++ b/eng/dependabot/Packages.props
@@ -12,9 +12,9 @@
-
-
-
+
+
+
diff --git a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetFloatRangeSpecification.cs b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetFloatRangeSpecification.cs
index c0e219f5522..3f51d7fc967 100644
--- a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetFloatRangeSpecification.cs
+++ b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetFloatRangeSpecification.cs
@@ -17,7 +17,7 @@ internal NuGetFloatRangeSpecification(FloatRange version)
public bool CheckIfVersionIsValid(string versionToCheck)
{
- if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
+ if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _version.Satisfies(nuGetVersion2);
}
@@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)
internal static bool TryParse(string value, out NuGetFloatRangeSpecification? version)
{
- if (FloatRange.TryParse(value, out FloatRange versionRange))
+ if (FloatRange.TryParse(value, out FloatRange? versionRange))
{
- version = new NuGetFloatRangeSpecification(versionRange);
+ version = new NuGetFloatRangeSpecification(versionRange!);
return true;
}
version = null;
diff --git a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionRangeSpecification.cs b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionRangeSpecification.cs
index edb9c9053d2..df76d80688c 100644
--- a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionRangeSpecification.cs
+++ b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionRangeSpecification.cs
@@ -17,7 +17,7 @@ internal NuGetVersionRangeSpecification(VersionRange versionRange)
public bool CheckIfVersionIsValid(string versionToCheck)
{
- if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
+ if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _versionRange.Satisfies(nuGetVersion2);
}
@@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)
internal static bool TryParse(string value, out NuGetVersionRangeSpecification? version)
{
- if (VersionRange.TryParse(value, out VersionRange versionRange))
+ if (VersionRange.TryParse(value, out VersionRange? versionRange))
{
- version = new NuGetVersionRangeSpecification(versionRange);
+ version = new NuGetVersionRangeSpecification(versionRange!);
return true;
}
version = null;
diff --git a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionSpecification.cs b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionSpecification.cs
index f5e8e26b3f1..a8a457746e1 100644
--- a/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionSpecification.cs
+++ b/src/Microsoft.TemplateEngine.Edge/Constraints/NuGetVersionSpecification.cs
@@ -17,7 +17,7 @@ internal NuGetVersionSpecification(NuGetVersion version)
public bool CheckIfVersionIsValid(string versionToCheck)
{
- if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion nuGetVersion2))
+ if (NuGetVersion.TryParse(versionToCheck, out NuGetVersion? nuGetVersion2))
{
return _version == nuGetVersion2;
}
@@ -28,9 +28,9 @@ public bool CheckIfVersionIsValid(string versionToCheck)
internal static bool TryParse(string value, out NuGetVersionSpecification? version)
{
- if (NuGetVersion.TryParse(value, out NuGetVersion nuGetVersion))
+ if (NuGetVersion.TryParse(value, out NuGetVersion? nuGetVersion))
{
- version = new NuGetVersionSpecification(nuGetVersion);
+ version = new NuGetVersionSpecification(nuGetVersion!);
return true;
}
version = null;
diff --git a/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NuGetVersionHelper.cs b/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NuGetVersionHelper.cs
index 2e1b7c73a89..f6627490c18 100644
--- a/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NuGetVersionHelper.cs
+++ b/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NuGetVersionHelper.cs
@@ -17,7 +17,7 @@ public static bool IsSupportedVersionString(string? versionString)
||
NuGetVersion.TryParse(versionString, out _)
||
- FloatRange.TryParse(versionString, out _);
+ FloatRange.TryParse(versionString!, out _);
}
public static bool IsUnrestricted(this FloatRange floatRange)
@@ -37,7 +37,7 @@ public static bool TryParseFloatRangeEx(string? versionString, out FloatRange fl
{
floatRange =
string.IsNullOrEmpty(versionString) ?
- UnspecifiedVersion : FloatRange.Parse(versionString);
+ UnspecifiedVersion : FloatRange.Parse(versionString!);
return floatRange.FloatBehavior != NuGetVersionFloatBehavior.None;
}
diff --git a/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NugetApiPackageManager.cs b/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NugetApiPackageManager.cs
index 2bce5550d7b..21907d47690 100644
--- a/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NugetApiPackageManager.cs
+++ b/src/Microsoft.TemplateEngine.Edge/Installers/NuGet/NugetApiPackageManager.cs
@@ -84,7 +84,7 @@ await GetLatestVersionInternalAsync(
}
else
{
- NuGetVersion packageVersion = new NuGetVersion(version);
+ NuGetVersion packageVersion = new NuGetVersion(version!);
(source, packageMetadata) = await GetPackageMetadataAsync(identifier, packageVersion, packagesSources, cancellationToken).ConfigureAwait(false);
}
@@ -94,7 +94,7 @@ await GetLatestVersionInternalAsync(
throw new VulnerablePackageException(
string.Format(LocalizableStrings.NuGetApiPackageManager_DownloadError_VulnerablePackage, source),
packageMetadata.Identity.Id,
- foundPackageVersion,
+ foundPackageVersion!,
packageMetadata.Vulnerabilities);
}
@@ -204,9 +204,9 @@ await GetLatestVersionInternalAsync(
//if preview version is installed, check for the latest preview version, otherwise for latest stable
bool previewVersionInstalled = false;
- if (NuGetVersion.TryParse(version, out NuGetVersion currentVersion))
+ if (NuGetVersion.TryParse(version, out NuGetVersion? currentVersion))
{
- previewVersionInstalled = currentVersion.IsPrerelease;
+ previewVersionInstalled = currentVersion!.IsPrerelease;
}
FloatRange floatRange = new FloatRange(previewVersionInstalled ? NuGetVersionFloatBehavior.AbsoluteLatest : NuGetVersionFloatBehavior.Major);
diff --git a/test/Microsoft.TemplateEngine.TestHelper/PackageManager.cs b/test/Microsoft.TemplateEngine.TestHelper/PackageManager.cs
index 8942bce05e7..c9f3e8bb810 100644
--- a/test/Microsoft.TemplateEngine.TestHelper/PackageManager.cs
+++ b/test/Microsoft.TemplateEngine.TestHelper/PackageManager.cs
@@ -192,7 +192,7 @@ internal async Task DownloadPackageAsync(
else
{
_nugetLogger.LogDebug($"[NuGet Package Manager] Getting package metadata {identifier}::{version}.");
- packageVersion = new NuGetVersion(version);
+ packageVersion = new NuGetVersion(version!);
(source, packageMetadata) = await GetPackageMetadataAsync(identifier, packageVersion, packagesSources, cancellationToken).ConfigureAwait(false);
}
diff --git a/tools/Microsoft.TemplateSearch.TemplateDiscovery/NuGet/NugetPackProvider.cs b/tools/Microsoft.TemplateSearch.TemplateDiscovery/NuGet/NugetPackProvider.cs
index 8487f377e34..164eba81d9c 100644
--- a/tools/Microsoft.TemplateSearch.TemplateDiscovery/NuGet/NugetPackProvider.cs
+++ b/tools/Microsoft.TemplateSearch.TemplateDiscovery/NuGet/NugetPackProvider.cs
@@ -146,7 +146,7 @@ public async Task DownloadPackageAsync(ITemplatePackageInfo
using Stream packageStream = File.Create(outputPackageFileNameFullPath);
if (await _downloadResource.CopyNupkgToStreamAsync(
packinfo.Name,
- new NuGetVersion(packinfo.Version),
+ new NuGetVersion(packinfo.Version!),
packageStream,
_cacheContext,
NullLogger.Instance,