From 1f6f2293cf6dd7a47607047a4153c5ba32b34a50 Mon Sep 17 00:00:00 2001 From: Zhi Li Date: Wed, 20 Apr 2016 14:01:49 -0700 Subject: [PATCH 1/2] fixed https://github.com/NuGet/Home/issues/2601 --- .../PackageManagement.VisualStudio/VSNuGetProjectFactory.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs b/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs index 51596e84ca6..0235d68145c 100644 --- a/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs +++ b/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs @@ -73,8 +73,9 @@ public NuGetProject CreateNuGetProject(EnvDTEProject envDTEProject, INuGetProjec // Treat projects with project.json as build integrated projects // Search for projectName.project.json first, then project.json - var projectJsonPath = ProjectJsonPathUtilities.GetProjectConfigPath( - msbuildProjectFile.DirectoryName, + var projectJsonPath = string.IsNullOrEmpty(projectNameFromMSBuildPath) ? + Path.Combine(msbuildProjectFile.DirectoryName, ProjectJsonPathUtilities.ProjectConfigFileName) + : ProjectJsonPathUtilities.GetProjectConfigPath(msbuildProjectFile.DirectoryName, projectNameFromMSBuildPath); if (File.Exists(projectJsonPath)) From c81a51d1166581e366490258365f809c5d0825c6 Mon Sep 17 00:00:00 2001 From: Zhi Li Date: Wed, 20 Apr 2016 14:23:40 -0700 Subject: [PATCH 2/2] review update --- .../VSNuGetProjectFactory.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs b/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs index 0235d68145c..e73dc421efa 100644 --- a/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs +++ b/src/NuGet.Clients/PackageManagement.VisualStudio/VSNuGetProjectFactory.cs @@ -73,10 +73,18 @@ public NuGetProject CreateNuGetProject(EnvDTEProject envDTEProject, INuGetProjec // Treat projects with project.json as build integrated projects // Search for projectName.project.json first, then project.json - var projectJsonPath = string.IsNullOrEmpty(projectNameFromMSBuildPath) ? - Path.Combine(msbuildProjectFile.DirectoryName, ProjectJsonPathUtilities.ProjectConfigFileName) - : ProjectJsonPathUtilities.GetProjectConfigPath(msbuildProjectFile.DirectoryName, + // For website project, since projectNameFromMSBuildPath is empty, only search project.json + string projectJsonPath = null; + if (string.IsNullOrEmpty(projectNameFromMSBuildPath)) + { + projectJsonPath = Path.Combine(msbuildProjectFile.DirectoryName, + ProjectJsonPathUtilities.ProjectConfigFileName); + } + else + { + projectJsonPath = ProjectJsonPathUtilities.GetProjectConfigPath(msbuildProjectFile.DirectoryName, projectNameFromMSBuildPath); + } if (File.Exists(projectJsonPath)) {