diff --git a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/LegacyPackageReferenceProject.cs b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/LegacyPackageReferenceProject.cs index 30a3aed64b1..3d7bb07c792 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/LegacyPackageReferenceProject.cs +++ b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/LegacyPackageReferenceProject.cs @@ -79,7 +79,7 @@ public override async Task GetAssetsFilePathAsync() public override async Task GetCacheFilePathAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); - return NoOpRestoreUtilities.GetProjectCacheFilePath(cacheRoot: GetBaseIntermediatePath(), projectPath: _projectFullPath); + return NoOpRestoreUtilities.GetProjectCacheFilePath(cacheRoot: GetMSBuildProjectExtensionsPath(), projectPath: _projectFullPath); } public override async Task GetAssetsFilePathOrNullAsync() @@ -91,7 +91,7 @@ private async Task GetAssetsFilePathAsync(bool shouldThrow) { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); - var baseIntermediatePath = GetBaseIntermediatePath(shouldThrow); + var baseIntermediatePath = GetMSBuildProjectExtensionsPath(shouldThrow); if (baseIntermediatePath == null) { @@ -164,25 +164,25 @@ public override async Task UninstallPackageAsync( #endregion - private string GetBaseIntermediatePath(bool shouldThrow = true) + private string GetMSBuildProjectExtensionsPath(bool shouldThrow = true) { ThreadHelper.ThrowIfNotOnUIThread(); - var baseIntermediatePath = _vsProjectAdapter.BaseIntermediateOutputPath; + var msbuildProjectExtensionsPath = _vsProjectAdapter.MSBuildProjectExtensionsPath; - if (string.IsNullOrEmpty(baseIntermediatePath)) + if (string.IsNullOrEmpty(msbuildProjectExtensionsPath)) { if (shouldThrow) { throw new InvalidDataException(string.Format( - Strings.BaseIntermediateOutputPathNotFound, + Strings.MSBuildProjectExtensionsPathNotFound, _vsProjectAdapter.ProjectDirectory)); } return null; } - return baseIntermediatePath; + return msbuildProjectExtensionsPath; } private string GetPackagesPath(ISettings settings) @@ -337,7 +337,7 @@ private async Task GetPackageSpecAsync(ISettings settings) RestoreMetadata = new ProjectRestoreMetadata { ProjectStyle = ProjectStyle.PackageReference, - OutputPath = GetBaseIntermediatePath(), + OutputPath = GetMSBuildProjectExtensionsPath(), ProjectPath = _projectFullPath, ProjectName = projectName, ProjectUniqueName = _projectFullPath, diff --git a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectAdapter.cs b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectAdapter.cs index 2c6b8195367..028dc6e53d2 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectAdapter.cs +++ b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectAdapter.cs @@ -35,18 +35,18 @@ internal class VsProjectAdapter : IVsProjectAdapter #region Properties - public string BaseIntermediateOutputPath + public string MSBuildProjectExtensionsPath { get { - var baseIntermediateOutputPath = BuildProperties.GetPropertyValue(ProjectBuildProperties.BaseIntermediateOutputPath); + var msbuildProjectExtensionsPath = BuildProperties.GetPropertyValue(ProjectBuildProperties.MSBuildProjectExtensionsPath); - if (string.IsNullOrEmpty(baseIntermediateOutputPath)) + if (string.IsNullOrEmpty(msbuildProjectExtensionsPath)) { return null; } - return Path.Combine(ProjectDirectory, baseIntermediateOutputPath); + return Path.Combine(ProjectDirectory, msbuildProjectExtensionsPath); } } diff --git a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectJsonNuGetProject.cs b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectJsonNuGetProject.cs index c0a6647d5df..61e82b521dd 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectJsonNuGetProject.cs +++ b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/VsProjectJsonNuGetProject.cs @@ -39,23 +39,23 @@ public VsProjectJsonNuGetProject( ProjectServices = projectServices; } - protected override async Task GetBaseIntermediatePathAsync() + protected override async Task GetMSBuildProjectExtensionsPathAsync() { - var baseIntermediatePath = await ProjectServices.BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.BaseIntermediateOutputPath); + var msbuildProjectExtensionsPath = await ProjectServices.BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.MSBuildProjectExtensionsPath); - if (string.IsNullOrEmpty(baseIntermediatePath)) + if (string.IsNullOrEmpty(msbuildProjectExtensionsPath)) { throw new InvalidDataException(string.Format( - Strings.BaseIntermediateOutputPathNotFound, + Strings.MSBuildProjectExtensionsPathNotFound, MSBuildProjectPath)); } - return UriUtility.GetAbsolutePathFromFile(MSBuildProjectPath, baseIntermediatePath); + return UriUtility.GetAbsolutePathFromFile(MSBuildProjectPath, msbuildProjectExtensionsPath); } public override async Task GetCacheFilePathAsync() { - return NoOpRestoreUtilities.GetProjectCacheFilePath(await GetBaseIntermediatePathAsync(), MSBuildProjectPath); + return NoOpRestoreUtilities.GetProjectCacheFilePath(await GetMSBuildProjectExtensionsPathAsync(), MSBuildProjectPath); } protected override async Task UpdateInternalTargetFrameworkAsync() diff --git a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.Designer.cs b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.Designer.cs index 5efa9a98f17..3febb11b0a3 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.Designer.cs +++ b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.Designer.cs @@ -114,15 +114,6 @@ public static string Argument_Must_Be_GreaterThanOrEqualTo { } } - /// - /// Looks up a localized string similar to The BaseIntermediateOutputPath MSBuild property could not be found for project '{0}'.. - /// - public static string BaseIntermediateOutputPathNotFound { - get { - return ResourceManager.GetString("BaseIntermediateOutputPathNotFound", resourceCulture); - } - } - /// /// Looks up a localized string similar to NuGet operation failed. /// @@ -339,6 +330,15 @@ public static string InstallingPackage { } } + /// + /// Looks up a localized string similar to The MSBuildProjectExtensionsPath MSBuild property could not be found for project '{0}'.. + /// + public static string MSBuildProjectExtensionsPathNotFound { + get { + return ResourceManager.GetString("MSBuildProjectExtensionsPathNotFound", resourceCulture); + } + } + /// /// Looks up a localized string similar to Package stream should be seekable. /// diff --git a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.resx b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.resx index 297d41eb99e..bd3e9de317b 100644 --- a/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.resx +++ b/src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Strings.resx @@ -200,8 +200,8 @@ The operation failed as details for project {0} could not be loaded. - - The BaseIntermediateOutputPath MSBuild property could not be found for project '{0}'. + + The MSBuildProjectExtensionsPath MSBuild property could not be found for project '{0}'. {0} is the full path to the project. diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Common/IVsProjectAdapter.cs b/src/NuGet.Clients/NuGet.VisualStudio.Common/IVsProjectAdapter.cs index e2dcc2cc173..5369f6dfea9 100644 --- a/src/NuGet.Clients/NuGet.VisualStudio.Common/IVsProjectAdapter.cs +++ b/src/NuGet.Clients/NuGet.VisualStudio.Common/IVsProjectAdapter.cs @@ -22,9 +22,9 @@ public interface IVsProjectAdapter string AssetTargetFallback { get; } /// - /// BaseIntermediateOutputPath project property (e.g. c:\projFoo\obj) + /// MSBuildProjectExtensionsPath project property (e.g. c:\projFoo\obj) /// - string BaseIntermediateOutputPath { get; } + string MSBuildProjectExtensionsPath { get; } IProjectBuildProperties BuildProperties { get; } diff --git a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RequestFactory/DependencyGraphSpecRequestProvider.cs b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RequestFactory/DependencyGraphSpecRequestProvider.cs index e0fee4741cd..06cd2bd6a71 100644 --- a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RequestFactory/DependencyGraphSpecRequestProvider.cs +++ b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RequestFactory/DependencyGraphSpecRequestProvider.cs @@ -153,7 +153,6 @@ private RestoreSummaryRequest Create( ProjectStyle = project.PackageSpec.RestoreMetadata.ProjectStyle, RestoreOutputPath = project.PackageSpec.RestoreMetadata.ProjectStyle == ProjectStyle.ProjectJson ? rootPath : project.PackageSpec.RestoreMetadata.OutputPath, DependencyGraphSpec = projectDgSpec, - BaseIntermediateOutputPath = projectPackageSpec.RestoreMetadata.OutputPath, ParentId = restoreArgs.ParentId }; diff --git a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreRequest.cs b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreRequest.cs index 45196fc819f..fd4850fb5c7 100644 --- a/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreRequest.cs +++ b/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreRequest.cs @@ -132,16 +132,10 @@ public RestoreRequest( public ProjectStyle ProjectStyle { get; set; } = ProjectStyle.Unknown; /// - /// Restore output path + /// MSBuildProjectExtensionsPath, which is where the restore output will go /// - public string RestoreOutputPath { get; set; } + public string MSBuildProjectExtensionsPath { get; set; } - /// - /// Base Intermediate output path - /// - public string BaseIntermediateOutputPath { get; set; } - - /// /// Compatibility options /// diff --git a/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/NoOpRestoreUtilities.cs b/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/NoOpRestoreUtilities.cs index 207d19f2b8a..4f50e3cabbf 100644 --- a/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/NoOpRestoreUtilities.cs +++ b/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/NoOpRestoreUtilities.cs @@ -26,7 +26,7 @@ internal static bool IsNoOpSupported(RestoreRequest request) } /// - /// The cache file path is $(BaseIntermediateOutputPath)\$(project).nuget.cache + /// The cache file path is $(MSBuildProjectExtensionsPath)\$(project).nuget.cache /// private static string GetBuildIntegratedProjectCacheFilePath(RestoreRequest request) { @@ -35,7 +35,7 @@ private static string GetBuildIntegratedProjectCacheFilePath(RestoreRequest requ || request.ProjectStyle == ProjectStyle.PackageReference || request.ProjectStyle == ProjectStyle.Standalone) { - var cacheRoot = request.BaseIntermediateOutputPath ?? request.RestoreOutputPath; + var cacheRoot = request.MSBuildProjectExtensionsPath; return request.Project.RestoreMetadata.CacheFilePath = GetProjectCacheFilePath(cacheRoot, request.Project.RestoreMetadata.ProjectPath); } diff --git a/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectBuildProperties.cs b/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectBuildProperties.cs index e34793008f6..6730f4a81ed 100644 --- a/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectBuildProperties.cs +++ b/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectBuildProperties.cs @@ -9,7 +9,7 @@ namespace NuGet.ProjectManagement /// public static class ProjectBuildProperties { - public const string BaseIntermediateOutputPath = "BaseIntermediateOutputPath"; + public const string MSBuildProjectExtensionsPath = "MSBuildProjectExtensionsPath"; public const string PackageTargetFallback = "PackageTargetFallback"; public const string AssetTargetFallback = "AssetTargetFallback"; public const string PackageVersion = "PackageVersion"; diff --git a/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectJsonNuGetProject.cs b/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectJsonNuGetProject.cs index 2e0801105b7..9af07ac72c0 100644 --- a/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectJsonNuGetProject.cs +++ b/src/NuGet.Core/NuGet.PackageManagement/Projects/ProjectJsonNuGetProject.cs @@ -151,10 +151,10 @@ public override async Task> GetInstalledPackagesAs return packages; } - protected virtual Task GetBaseIntermediatePathAsync() + protected virtual Task GetMSBuildProjectExtensionsPathAsync() { - // Extending class will implement the functionality. - return Task.FromResult((string) null); + // Extending class will implement the functionality (but this method can't be abstract as tests create it directly) + return Task.FromResult((string)null); } public override async Task> GetPackageSpecsAsync(DependencyGraphCacheContext context) @@ -172,7 +172,7 @@ public override async Task> GetPackageSpecsAsync(Depe packageSpec.RestoreMetadata = metadata; metadata.ProjectStyle = ProjectStyle.ProjectJson; - metadata.OutputPath = await GetBaseIntermediatePathAsync(); + metadata.OutputPath = await GetMSBuildProjectExtensionsPathAsync(); metadata.ProjectPath = MSBuildProjectPath; metadata.ProjectJsonPath = packageSpec.FilePath; metadata.ProjectName = packageSpec.Name; diff --git a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectSystems/LegacyPackageReferenceProjectTests.cs b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectSystems/LegacyPackageReferenceProjectTests.cs index 5df51ce216a..d66cc5aa4bd 100644 --- a/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectSystems/LegacyPackageReferenceProjectTests.cs +++ b/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/ProjectSystems/LegacyPackageReferenceProjectTests.cs @@ -43,17 +43,17 @@ public LegacyPackageReferenceProjectTests(DispatcherThreadFixture fixture) } [Fact] - public async Task GetAssetsFilePathAsync_WithValidBaseIntermediateOutputPath_Succeeds() + public async Task GetAssetsFilePathAsync_WithValidMSBuildProjectExtensionsPath_Succeeds() { // Arrange using (var testDirectory = TestDirectory.Create()) { - var testBaseIntermediateOutputPath = Path.Combine(testDirectory, "obj"); - Directory.CreateDirectory(testBaseIntermediateOutputPath); + var testMSBuildProjectExtensionsPath = Path.Combine(testDirectory, "obj"); + Directory.CreateDirectory(testMSBuildProjectExtensionsPath); var projectAdapter = Mock.Of(); Mock.Get(projectAdapter) - .SetupGet(x => x.BaseIntermediateOutputPath) - .Returns(testBaseIntermediateOutputPath); + .SetupGet(x => x.MSBuildProjectExtensionsPath) + .Returns(testMSBuildProjectExtensionsPath); var testProject = new LegacyPackageReferenceProject( projectAdapter, @@ -67,16 +67,16 @@ public async Task GetAssetsFilePathAsync_WithValidBaseIntermediateOutputPath_Suc var assetsPath = await testProject.GetAssetsFilePathAsync(); // Assert - Assert.Equal(Path.Combine(testBaseIntermediateOutputPath, "project.assets.json"), assetsPath); + Assert.Equal(Path.Combine(testMSBuildProjectExtensionsPath, "project.assets.json"), assetsPath); // Verify Mock.Get(projectAdapter) - .VerifyGet(x => x.BaseIntermediateOutputPath, Times.AtLeastOnce); + .VerifyGet(x => x.MSBuildProjectExtensionsPath, Times.AtLeastOnce); } } [Fact] - public async Task GetAssetsFilePathAsync_WithNoBaseIntermediateOutputPath_Throws() + public async Task GetAssetsFilePathAsync_WithNoMSBuildProjectExtensionsPath_Throws() { // Arrange using (TestDirectory.Create()) @@ -96,18 +96,18 @@ await Assert.ThrowsAsync( } [Fact] - public async Task GetCacheFilePathAsync_WithValidBaseIntermediateOutputPath_Succeeds() + public async Task GetCacheFilePathAsync_WithValidMSBuildProjectExtensionsPath_Succeeds() { // Arrange using (var testDirectory = TestDirectory.Create()) { var testProj = "project.csproj"; - var testBaseIntermediateOutputPath = Path.Combine(testDirectory, "obj"); - Directory.CreateDirectory(testBaseIntermediateOutputPath); + var testMSBuildProjectExtensionsPath = Path.Combine(testDirectory, "obj"); + Directory.CreateDirectory(testMSBuildProjectExtensionsPath); var projectAdapter = Mock.Of(); Mock.Get(projectAdapter) - .SetupGet(x => x.BaseIntermediateOutputPath) - .Returns(testBaseIntermediateOutputPath); + .SetupGet(x => x.MSBuildProjectExtensionsPath) + .Returns(testMSBuildProjectExtensionsPath); Mock.Get(projectAdapter) .SetupGet(x => x.FullProjectPath) @@ -125,16 +125,16 @@ public async Task GetCacheFilePathAsync_WithValidBaseIntermediateOutputPath_Succ var cachePath = await testProject.GetCacheFilePathAsync(); // Assert - Assert.Equal(Path.Combine(testBaseIntermediateOutputPath, $"{testProj}.nuget.cache"), cachePath); + Assert.Equal(Path.Combine(testMSBuildProjectExtensionsPath, $"{testProj}.nuget.cache"), cachePath); // Verify Mock.Get(projectAdapter) - .VerifyGet(x => x.BaseIntermediateOutputPath, Times.AtLeastOnce); + .VerifyGet(x => x.MSBuildProjectExtensionsPath, Times.AtLeastOnce); } } [Fact] - public async Task GetCacheFilePathAsync_WithNoBaseIntermediateOutputPath_Throws() + public async Task GetCacheFilePathAsync_WithNoMSBuildProjectExtensionsPath_Throws() { // Arrange using (TestDirectory.Create()) @@ -160,12 +160,12 @@ public async Task GetCacheFilePathAsync_SwitchesToMainThread_Succeeds() using (var testDirectory = TestDirectory.Create()) { var testProj = "project.csproj"; - var testBaseIntermediateOutputPath = Path.Combine(testDirectory, "obj"); - Directory.CreateDirectory(testBaseIntermediateOutputPath); + var testMSBuildProjectExtensionsPath = Path.Combine(testDirectory, "obj"); + Directory.CreateDirectory(testMSBuildProjectExtensionsPath); var projectAdapter = Mock.Of(); Mock.Get(projectAdapter) - .SetupGet(x => x.BaseIntermediateOutputPath) - .Returns(testBaseIntermediateOutputPath); + .SetupGet(x => x.MSBuildProjectExtensionsPath) + .Returns(testMSBuildProjectExtensionsPath); Mock.Get(projectAdapter) .SetupGet(x => x.FullProjectPath) @@ -181,11 +181,11 @@ public async Task GetCacheFilePathAsync_SwitchesToMainThread_Succeeds() var assetsPath = await testProject.GetCacheFilePathAsync(); // Assert - Assert.Equal(Path.Combine(testBaseIntermediateOutputPath, $"{testProj}.nuget.cache"), assetsPath); + Assert.Equal(Path.Combine(testMSBuildProjectExtensionsPath, $"{testProj}.nuget.cache"), assetsPath); // Verify Mock.Get(projectAdapter) - .VerifyGet(x => x.BaseIntermediateOutputPath, Times.AtLeastOnce); + .VerifyGet(x => x.MSBuildProjectExtensionsPath, Times.AtLeastOnce); } } @@ -776,11 +776,11 @@ private static IVsProjectAdapter CreateProjectAdapter(string fullPath) .Setup(x => x.GetTargetFrameworkAsync()) .ReturnsAsync(NuGetFramework.Parse("netstandard13")); - var testBaseIntermediateOutputPath = Path.Combine(fullPath, "obj"); - Directory.CreateDirectory(testBaseIntermediateOutputPath); + var testMSBuildProjectExtensionsPath = Path.Combine(fullPath, "obj"); + Directory.CreateDirectory(testMSBuildProjectExtensionsPath); projectAdapter - .Setup(x => x.BaseIntermediateOutputPath) - .Returns(testBaseIntermediateOutputPath); + .Setup(x => x.MSBuildProjectExtensionsPath) + .Returns(testMSBuildProjectExtensionsPath); return projectAdapter.Object; } diff --git a/test/TestUtilities/Test.Utility/SimpleTestSetup/SimpleTestProjectContext.cs b/test/TestUtilities/Test.Utility/SimpleTestSetup/SimpleTestProjectContext.cs index 05a1af743d3..e1dc5abc496 100644 --- a/test/TestUtilities/Test.Utility/SimpleTestSetup/SimpleTestProjectContext.cs +++ b/test/TestUtilities/Test.Utility/SimpleTestSetup/SimpleTestProjectContext.cs @@ -60,7 +60,7 @@ public SimpleTestProjectContext(string projectName, ProjectStyle type, string so public string ProjectPath { get; set; } /// - /// Base intermediate directory path + /// MSBuildProjectExtensionsPath /// public string OutputPath { get; set; } @@ -396,7 +396,7 @@ public XDocument GetXML() ProjectFileUtils.AddProperties(xml, new Dictionary() { { "ProjectGuid", "{" + ProjectGuid.ToString() + "}" }, - { "BaseIntermediateOutputPath", OutputPath }, + { "MSBuildProjectExtensionsPath", OutputPath }, { "AssemblyName", ProjectName } });