Skip to content

Commit

Permalink
Use and clear a local nuget cache (#13256)
Browse files Browse the repository at this point in the history
* Use and clear a local nuget cache

* more
  • Loading branch information
mattleibow authored Feb 17, 2023
1 parent 0c6a2aa commit 77dfce0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions eng/cake/dotnet.cake
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ Task("VS")
Error("!!!!BUILD TASKS FAILED: !!!!!");
}
UseLocalNuGetCacheFolder();
StartVisualStudioForDotNet6();
});

Expand Down Expand Up @@ -568,6 +570,23 @@ void SetDotNetEnvironmentVariables()
SetEnvironmentVariable("MSBuildDebugEngine", "1");
}

void UseLocalNuGetCacheFolder(bool reset = false)
{
var temp = Context.Environment.GetSpecialPath(SpecialPath.LocalTemp);
var packages = temp.Combine("Microsoft.Maui.Cache/NuGet/packages");

EnsureDirectoryExists(packages);

CleanDirectories(packages.FullPath + "/microsoft.maui.*");
CleanDirectories(packages.FullPath + "/microsoft.aspnetcore.*");

if (reset)
CleanDirectories(packages.FullPath);

SetEnvironmentVariable("RestorePackagesPath", packages.FullPath);
SetEnvironmentVariable("NUGET_PACKAGES", packages.FullPath);
}

void StartVisualStudioForDotNet6()
{
string sln = Argument<string>("sln", null);
Expand Down

0 comments on commit 77dfce0

Please sign in to comment.