From 7960c8032a98990d5a4a96ae0e6be7f66327e24b Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Wed, 9 May 2018 10:10:13 -0500 Subject: [PATCH] Avoid RuntimeInformation on full sln parse We started (transitively) requiring System.Runtime.InteropServices.RuntimeInformation when using `SolutionFile.Parse` after #2963. The assembly-level dependency is longstanding. But since it wasn't needed in NuGet's calling pattern, many versions of NuGet are broken on older (pre-4.7.1) .NET Frameworks. Work around the assembly load by avoiding the adjustment filepath on full-Framework MSBuild (where it's not necessary anyway). Closes #3282. --- src/Build/Construction/Solution/ProjectInSolution.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Build/Construction/Solution/ProjectInSolution.cs b/src/Build/Construction/Solution/ProjectInSolution.cs index ffe522502b8..a8ebef107a3 100644 --- a/src/Build/Construction/Solution/ProjectInSolution.cs +++ b/src/Build/Construction/Solution/ProjectInSolution.cs @@ -158,8 +158,14 @@ public string RelativePath get { return _relativePath; } internal set { +#if NETFRAMEWORK && !MONO + // Avoid loading System.Runtime.InteropServices.RuntimeInformation in full-framework + // cases. It caused https://github.com/NuGet/Home/issues/6918. + _relativePath = value; +#else _relativePath = FileUtilities.MaybeAdjustFilePath(value, baseDirectory:this.ParentSolution.SolutionFileDirectory ?? String.Empty); +#endif } }