diff options
6 files changed, 43 insertions, 0 deletions
diff --git a/main/external/nuget-binary b/main/external/nuget-binary -Subproject 6231bba5372334d515dac43c876255765ca2fb6 +Subproject ebedbf8b90e2f138fa9bc120807abced307fbfb diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/DummyDotNetProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/DummyDotNetProject.cs index 12ec5df69c..f49c34592a 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/DummyDotNetProject.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/DummyDotNetProject.cs @@ -35,6 +35,9 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public DummyDotNetProject () : base ("C#") { + // Set the TypeGuid to be a C# project so the default file extension will + // be .csproj and not .mdproj + TypeGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"; Initialize (this); } diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DotNetCoreNuGetProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DotNetCoreNuGetProjectTests.cs index 69135e9943..2652816dd4 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DotNetCoreNuGetProjectTests.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DotNetCoreNuGetProjectTests.cs @@ -500,5 +500,16 @@ namespace MonoDevelop.PackageManagement.Tests Assert.AreEqual ("References", modifiedHintMainProject); Assert.IsNull (modifiedHintProjectWithReference); } + + [Test] + public async Task GetCacheFilePathAsync_BaseIntermediatePathNotSet_BaseIntermediatePathUsedForCacheFilePath () + { + CreateNuGetProject ("MyProject", @"d:\projects\MyProject\MyProject.csproj"); + string expectedCacheFilePath = @"d:\projects\MyProject\obj\MyProject.csproj.nuget.cache".ToNativePath (); + + string cacheFilePath = await project.GetCacheFilePathAsync (); + + Assert.AreEqual (expectedCacheFilePath, cacheFilePath); + } } } diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageReferenceNuGetProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageReferenceNuGetProjectTests.cs index 0ca059a5d3..88c7e8e91d 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageReferenceNuGetProjectTests.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageReferenceNuGetProjectTests.cs @@ -257,6 +257,17 @@ namespace MonoDevelop.PackageManagement.Tests } [Test] + public async Task GetCacheFilePathAsync_BaseIntermediatePathNotSet_BaseIntermediatePathUsedForCacheFilePath () + { + CreateNuGetProject ("MyProject", @"d:\projects\MyProject\MyProject.csproj"); + string expectedCacheFilePath = @"d:\projects\MyProject\obj\MyProject.csproj.nuget.cache".ToNativePath (); + + string cacheFilePath = await project.GetCacheFilePathAsync (); + + Assert.AreEqual (expectedCacheFilePath, cacheFilePath); + } + + [Test] public void Create_NoPackageReferences_ReturnsNull () { CreateNuGetProject (); diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetCoreNuGetProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetCoreNuGetProject.cs index bd1900e7ec..2a168cec3d 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetCoreNuGetProject.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetCoreNuGetProject.cs @@ -30,6 +30,7 @@ using System.Threading; using System.Threading.Tasks; using MonoDevelop.Core; using MonoDevelop.Projects; +using NuGet.Commands; using NuGet.Frameworks; using NuGet.PackageManagement; using NuGet.Packaging; @@ -205,6 +206,14 @@ namespace MonoDevelop.PackageManagement return GetAssetsFilePathAsync (); } + public override Task<string> GetCacheFilePathAsync () + { + string cacheFilePath = NoOpRestoreUtilities.GetProjectCacheFilePath ( + project.BaseIntermediateOutputPath, + msbuildProjectPath); + return Task.FromResult (cacheFilePath); + } + public override async Task<IReadOnlyList<PackageSpec>> GetPackageSpecsAsync (DependencyGraphCacheContext context) { PackageSpec existingPackageSpec = GetExistingProjectPackageSpec (context); diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageReferenceNuGetProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageReferenceNuGetProject.cs index 676b47499e..99b7bdf2df 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageReferenceNuGetProject.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageReferenceNuGetProject.cs @@ -30,6 +30,7 @@ using System.Threading; using System.Threading.Tasks; using MonoDevelop.Core; using MonoDevelop.Projects; +using NuGet.Commands; using NuGet.Frameworks; using NuGet.PackageManagement; using NuGet.Packaging; @@ -196,6 +197,14 @@ namespace MonoDevelop.PackageManagement return GetAssetsFilePathAsync (); } + public override Task<string> GetCacheFilePathAsync () + { + string cacheFilePath = NoOpRestoreUtilities.GetProjectCacheFilePath ( + project.BaseIntermediateOutputPath, + msbuildProjectPath); + return Task.FromResult (cacheFilePath); + } + public override async Task<IReadOnlyList<PackageSpec>> GetPackageSpecsAsync (DependencyGraphCacheContext context) { PackageSpec existingPackageSpec = GetExistingProjectPackageSpec (context); |