From 031f8b2f8020aed9bb0e06188c3b4c12100d9797 Mon Sep 17 00:00:00 2001 From: icedream Date: Mon, 12 Jan 2015 05:07:52 +0100 Subject: [PATCH] NuGet startup and temp writing fails on my test machines. Fixing these edge cases. --- src/updater/Program.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/updater/Program.cs b/src/updater/Program.cs index d58ebd2..f1a1747 100644 --- a/src/updater/Program.cs +++ b/src/updater/Program.cs @@ -290,6 +290,23 @@ namespace CitizenMP.Server.Installer // Mono compatibility Environment.SetEnvironmentVariable("MONO_IOMAP", "all"); + { + // The NuGet.exe that is shipped with CitizenMP.Server has a few bugs... + var nugetExePath = Path.Combine(workspace.FullName, ".nuget", "NuGet.exe"); + Console.WriteLine("Updating NuGet..."); + File.Delete(nugetExePath); + using (var wc = new WebClient()) + { + wc.DownloadFile("https://nuget.org/NuGet.exe", nugetExePath); + } + } + + // Make sure we restore nuget packages automatically and without permissions interfering with /tmp/nuget/ (edge case) + var newTempDir = workspace.CreateSubdirectory(".tmp"); + Environment.SetEnvironmentVariable("EnableNuGetPackageRestore", "true"); + Environment.SetEnvironmentVariable("TEMP", newTempDir.FullName); + Environment.SetEnvironmentVariable("TMP", newTempDir.FullName); + try { var pc = new ProjectCollection(); @@ -368,6 +385,8 @@ namespace CitizenMP.Server.Installer { if (projectFilePath.EndsWith(".proj")) File.Delete(projectFilePath); + + newTempDir.Delete(true); } }