Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only want to trigger this path if the workloads switch != global yea?

like if we have

dotnet cake --target=VS --workloads=global

then don't setup a local path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure... You don't want 7.0.100-dev in the global nuget cache. If you are using global workloads, you can still have local nugets?


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