From c27cbfc95402afb1a1771f9a7324cf35f08c93cd Mon Sep 17 00:00:00 2001 From: Kartheek Penagamuri <52756182+kartheekp-ms@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:24:22 -0700 Subject: [PATCH] fix compile errors in NuGet.CommandLine project that broke the builds locally (#5710) --- src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs | 2 ++ src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs b/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs index e68f3969186..50bea4e3636 100644 --- a/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs +++ b/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs @@ -761,6 +761,7 @@ private PackageDependency CreateDependencyFromProject(dynamic project, Dictionar projectFactory.InitializeProperties(builder); +#pragma warning disable CS0612 // Type or member is obsolete if (!projectFactory.ProcessJsonFile(builder, project.DirectoryPath, null)) { projectFactory.ProcessNuspec(builder, null); @@ -772,6 +773,7 @@ private PackageDependency CreateDependencyFromProject(dynamic project, Dictionar string.Format(CultureInfo.CurrentCulture, NuGetResources.ProjectJsonPack_Deprecated, builder.Id), NuGetLogCode.NU5126)); } +#pragma warning restore CS0612 // Type or member is obsolete VersionRange versionRange = null; if (dependencies.ContainsKey(builder.Id)) diff --git a/src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs b/src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs index 3f0da667878..327f645b746 100644 --- a/src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs +++ b/src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs @@ -135,7 +135,7 @@ private void LoadSolutionWithMsbuild14(Assembly msbuildAssembly, string solution try { - var projectShouldBuild = !isSolutionFilter || projectShouldBuildMethod.Invoke(solutionFile, new object[] { project.RelativePath }); + var projectShouldBuild = !isSolutionFilter || (bool)projectShouldBuildMethod.Invoke(solutionFile, new object[] { project.RelativePath }); if (projectShouldBuild) { var relativePath = project.RelativePath.Replace('\\', Path.DirectorySeparatorChar);