From a1cd9c66fec49c51f9b9a83c0bde616d6af67bcf Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Tue, 23 May 2017 16:47:15 -0400 Subject: [PATCH] [create-vsix] Fix creation under mono/2017-04 Context: https://bugzilla.xamarin.com/show_bug.cgi?id=56633 Commit 8cc4acb0 (or thereabouts) [broke `.vsix` file generation][0]: error MSB4174: The task factory "CodeTaskFactory" could not be found in the assembly "/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.v4.0.dll". (This works in mono/2017-02, fails with mono/2017-04.) Fix `.vsix` generation by *not using* `Microsoft.VSSDK.BuildTools.15.0.26201\build\Microsoft.VSSDK.BuildTools.targets`, and instead *copying and "fixing"* the contents of `Microsoft.VSSDK.BuildTools.targets` into `create-vsix.targets`. In particular, the corrected `` task uses `Microsoft.Build.Tasks.Core.dll`, *not* `Microsoft.Build.Tasks.v4.0.dll`. [0]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/392/consoleText --- build-tools/create-vsix/create-vsix.csproj | 1 - build-tools/create-vsix/create-vsix.targets | 30 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/build-tools/create-vsix/create-vsix.csproj b/build-tools/create-vsix/create-vsix.csproj index dfbcd97eec2..38088d85fc7 100644 --- a/build-tools/create-vsix/create-vsix.csproj +++ b/build-tools/create-vsix/create-vsix.csproj @@ -62,7 +62,6 @@ - {7CE69551-BD73-4726-ACAA-AAF89C84BAF8} diff --git a/build-tools/create-vsix/create-vsix.targets b/build-tools/create-vsix/create-vsix.targets index e7159c0bac1..5cc7f9aae9b 100644 --- a/build-tools/create-vsix/create-vsix.targets +++ b/build-tools/create-vsix/create-vsix.targets @@ -121,4 +121,34 @@ DestinationFiles="$(VsixPath)" /> + + + <_TasksAssembly Condition=" Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll') ">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll + <_TasksAssembly Condition=" '$(_TasksAssembly)' == '' ">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll + + + + + + + + var toolsPath = System.IO.Path.Combine(ProjectDirectory, "tools", "VSSDK", "bin"); + System.Environment.SetEnvironmentVariable("VsSDKToolsPath", + System.IO.Path.GetFullPath(toolsPath), + EnvironmentVariableTarget.Process); + var schemaDir = System.IO.Path.Combine(ProjectDirectory, "tools", "VSSDK", "schemas"); + System.Environment.SetEnvironmentVariable("VsSDKSchemaDir", + System.IO.Path.GetFullPath(schemaDir), + EnvironmentVariableTarget.Process); + + + + + +