Skip to content

Commit

Permalink
Make NuGet install fire and forget
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Feb 24, 2023
1 parent 711dc64 commit 1d105d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,7 @@ private static async Task InstallNuGetPackagesAsync(Project project, bool onlyGe

foreach (var nuGetPackage in packages)
{
var done = nuGetHelper.InstallPackage(nuGetPackage.PackageId, project, new Version(nuGetPackage.Version));

if (!done)
{
await VS.StatusBar.ShowMessageAsync("Provider package installation failed, install manually.");
}
nuGetHelper.InstallPackage(nuGetPackage.PackageId, project, new Version(nuGetPackage.Version));
}
}

Expand Down
25 changes: 4 additions & 21 deletions src/GUI/Shared/Helpers/NuGetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace EFCorePowerTools.Helpers
{
public class NuGetHelper
{
public bool InstallPackage(string packageId, Project project, Version version = null)
public void InstallPackage(string packageId, Project project, Version version = null)
{
var args = $"add \"{project.FullPath}\" package {packageId} ";
if (version != null)
Expand All @@ -20,34 +20,17 @@ public bool InstallPackage(string packageId, Project project, Version version =
Arguments = args,
};

var result = RunProcess(startInfo);

return result;
RunProcess(startInfo);
}

private static bool RunProcess(ProcessStartInfo startInfo)
private static void RunProcess(ProcessStartInfo startInfo)
{
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow = true;

var completed = true;

using (var process = Process.Start(startInfo))
{
while (process != null && !process.HasExited)
{
completed = false;
}

if (process != null && process.HasExited)
{
completed = process.ExitCode == 0;
}
}

return completed;
Process.Start(startInfo);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class NorthwindContext
{

[DbFunction("ISOweek", "dbo")]
public static int? _ISOweek(DateTime? DATE)
public static int? ISOweek(DateTime? DATE)
{
throw new NotSupportedException("This method can only be called from Entity Framework Core queries");
}
Expand Down

0 comments on commit 1d105d5

Please sign in to comment.