Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Osenkov <kirillo@microsoft.com>2018-07-20 04:52:17 +0300
committerKirill Osenkov <kirillo@microsoft.com>2018-07-20 04:52:17 +0300
commit17edd4a4b9e9c54bf32bb2ef6772c525f2ed8e85 (patch)
treed5597d5904e2cfbc421c144939862b8d937b83ac /main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs
parenta030171b80d03f1ce1fed42f5398e8d58309492a (diff)
Fix VSTS 651402
MSBuild has replaced the NuGet SDK resolver with an .xml manifest file which points to the location where to find the NuGet SDK resolver on disk. See this change for details: https://github.com/Microsoft/msbuild/pull/3246
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs42
1 files changed, 34 insertions, 8 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs
index b7f483c2b9..28f42571af 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/RemoteBuildEngineManager.cs
@@ -493,17 +493,13 @@ namespace MonoDevelop.Projects.MSBuild
// Copy the whole MSBuild bin folder and subfolders. We need all support assemblies
// and files.
-
FileService.CopyDirectory (binDir, exesDir);
- // Copy the MonoDevelop resolver, used for sdks registered by add-ins.
- // This resolver will load registered sdks from the file sdks.config
-
- if (!Directory.Exists (mdResolverDir))
- Directory.CreateDirectory (mdResolverDir);
+ CopyMonoDevelopResolver (mdResolverDir);
- var builderDir = new FilePath (typeof (MSBuildProjectService).Assembly.Location).ParentDirectory.Combine ("MSBuild");
- File.Copy (Path.Combine (builderDir, "MonoDevelop.MSBuildResolver.dll"), Path.Combine (mdResolverDir, "MonoDevelop.MSBuildResolver.dll"));
+ if (Platform.IsWindows) {
+ PatchNuGetSdkResolver (binDir, localResolversDir);
+ }
searchPathConfigNeedsUpdate = true;
}
@@ -516,6 +512,36 @@ namespace MonoDevelop.Projects.MSBuild
return destinationExe;
}
+ static void CopyMonoDevelopResolver (string mdResolverDir)
+ {
+ // Copy the MonoDevelop resolver, used for sdks registered by add-ins.
+ // This resolver will load registered sdks from the file sdks.config
+ if (!Directory.Exists (mdResolverDir))
+ Directory.CreateDirectory (mdResolverDir);
+
+ var builderDir = new FilePath (typeof (MSBuildProjectService).Assembly.Location).ParentDirectory.Combine ("MSBuild");
+ File.Copy (Path.Combine (builderDir, "MonoDevelop.MSBuildResolver.dll"), Path.Combine (mdResolverDir, "MonoDevelop.MSBuildResolver.dll"));
+ }
+
+ /// <summary>
+ /// Make sure our copy of the manifest XML points at the valid NuGet resolver location within Visual Studio path.
+ /// When we copy the manifest XML the relative path becomes invalid.
+ /// </summary>
+ /// <param name="msbuildBinDir">A path similar to C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin</param>
+ /// <param name="localSdkResolversDir">A path similar to C:\Users\user\AppData\Local\MonoDevelop\7.0\Cache\MSBuild\6976_1\SdkResolvers</param>
+ static void PatchNuGetSdkResolver (string msbuildBinDir, string localSdkResolversDir)
+ {
+ var resolverXml = Path.Combine (localSdkResolversDir, "Microsoft.Build.NuGetSdkResolver", "Microsoft.Build.NuGetSdkResolver.xml");
+ if (File.Exists (resolverXml)) {
+ var vsRoot = new FilePath (msbuildBinDir).ParentDirectory.ParentDirectory.ParentDirectory;
+ var resolverDll = vsRoot.Combine ("Common7", "IDE", "CommonExtensions", "Microsoft", "NuGet", "Microsoft.Build.NuGetSdkResolver.dll");
+ var newText = $@"<SdkResolver>
+ <Path>{resolverDll}</Path>
+</SdkResolver>";
+ File.WriteAllText (resolverXml, newText);
+ }
+ }
+
static void UpdateMSBuildExeConfigFile (TargetRuntime runtime, string sourceConfigFile, string destinationConfigFile, string mdResolverConfig, string binDir)
{
// Creates an MSBuild config file with the search paths registered by add-ins.