Skip to content

Commit 2a3260a

Browse files
authored
Merge pull request #660 from dotnet/fix588
Fix `nbgv` dependencies
2 parents 0b29e5a + 2b80c11 commit 2a3260a

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

src/nbgv/Program.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,23 @@ private static Parser BuildCommandLine()
215215
}
216216
}
217217
}, (MiddlewareOrder)(-3000)) // MiddlewareOrderInternal.ExceptionHandler so [parse] directive is accurate.
218+
.UseExceptionHandler((ex, context) => PrintException(ex, context))
218219
.Build();
219220
}
220221

222+
private static void PrintException(Exception ex, InvocationContext context)
223+
{
224+
try
225+
{
226+
Console.Error.WriteLine("Unhandled exception: {0}", ex);
227+
}
228+
catch (Exception ex2)
229+
{
230+
Console.Error.WriteLine("Unhandled exception: {0}", ex.Message);
231+
Console.Error.WriteLine("Unhandled exception while trying to print string version of the above exception: {0}", ex2);
232+
}
233+
}
234+
221235
private static int MainInner(string[] args)
222236
{
223237
try
@@ -347,16 +361,16 @@ private static int OnInstallCommand(string path, string version, IReadOnlyList<s
347361
return (int)ExitCodes.OK;
348362
}
349363

350-
private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitIsh)
364+
private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitish)
351365
{
352366
if (string.IsNullOrEmpty(format))
353367
{
354368
format = DefaultOutputFormat;
355369
}
356370

357-
if (string.IsNullOrEmpty(commitIsh))
371+
if (string.IsNullOrEmpty(commitish))
358372
{
359-
commitIsh = DefaultRef;
373+
commitish = DefaultRef;
360374
}
361375

362376
string searchPath = GetSpecifiedOrCurrentDirectoryPath(project);
@@ -368,9 +382,9 @@ private static int OnGetVersionCommand(string project, IReadOnlyList<string> met
368382
return (int)ExitCodes.NoGitRepo;
369383
}
370384

371-
if (!context.TrySelectCommit(commitIsh))
385+
if (!context.TrySelectCommit(commitish))
372386
{
373-
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitIsh);
387+
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitish);
374388
return (int)ExitCodes.BadGitRef;
375389
}
376390

@@ -759,7 +773,7 @@ private static async Task<string> GetLatestPackageVersionAsync(string packageId,
759773
var providers = new List<Lazy<INuGetResourceProvider>>();
760774
providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support
761775

762-
var sourceRepositoryProvider = new SourceRepositoryProvider(settings, providers);
776+
var sourceRepositoryProvider = new SourceRepositoryProvider(new PackageSourceProvider(settings), providers);
763777

764778
// Select package sources based on NuGet.Config files or given options, as 'nuget.exe restore' command does
765779
// See also 'DownloadCommandBase.GetPackageSources(ISettings)' at https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/NuGet.CommandLine/Commands/DownloadCommandBase.cs

src/nbgv/nbgv.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="NuGet.PackageManagement" Version="4.9.3" NoWarn="NU1701" />
14-
<PackageReference Include="NuGet.Resolver" Version="4.9.3" />
13+
<PackageReference Include="NuGet.PackageManagement" Version="5.11.0" />
1514
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
1615
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="3.4.173-alpha" PrivateAssets="all" />
1716
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" />
18-
<PackageReference Include="Microsoft.Build" Version="15.9.20" />
17+
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
1918
</ItemGroup>
2019

2120
<ItemGroup>

0 commit comments

Comments
 (0)