diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs index e5f565cc96..e2622282bb 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs @@ -42,7 +42,7 @@ namespace PythonBinding.Tests.Converter [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); List bindings = new List(); using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs index f94b1eb298..44fd87a9d2 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs @@ -54,7 +54,7 @@ namespace PythonBinding.Tests.Converter [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); List bindings = new List(); using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs index 77c59a6125..51e9680c84 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs @@ -30,7 +30,7 @@ namespace PythonBinding.Tests.Gui [SetUp] public void SetUp() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); ProjectCreateInformation info = new ProjectCreateInformation(); info.Solution = new Solution(); diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs index 7e6b51e07f..2dab6e0d99 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs @@ -30,7 +30,7 @@ namespace PythonBinding.Tests.Gui [SetUp] public void SetUp() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); ProjectCreateInformation info = new ProjectCreateInformation(); info.Solution = new Solution(); diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs index 01c3bf0853..49e6f55707 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs @@ -29,7 +29,7 @@ namespace PythonBinding.Tests.Parsing [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); parser = new PythonParser(); } diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj index 1c500c2d14..6d57011de2 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj @@ -446,7 +446,7 @@ - + diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs index 5c26429f3d..33d9f75264 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs @@ -31,7 +31,7 @@ namespace PythonBinding.Tests.PythonLanguage [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); info = new ProjectCreateInformation(); info.Solution = new Solution(); diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs index 7b5b0f64be..81b6f36eaf 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs @@ -24,7 +24,7 @@ namespace PythonBinding.Tests.Testing [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + PythonMSBuildEngineHelper.InitMSBuildEngine(); } [SetUp] diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MSBuildEngineHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs similarity index 50% rename from src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MSBuildEngineHelper.cs rename to src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs index 749df0ba9e..c7c87a5574 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MSBuildEngineHelper.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs @@ -8,16 +8,14 @@ using System; using System.IO; using ICSharpCode.PythonBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Project; namespace PythonBinding.Tests.Utils { - /// - /// Description of MSBuildEngineHelper. - /// - public sealed class MSBuildEngineHelper + public sealed class PythonMSBuildEngineHelper { - MSBuildEngineHelper() + PythonMSBuildEngineHelper() { } @@ -25,23 +23,15 @@ namespace PythonBinding.Tests.Utils /// The MSBuildEngine sets the PythonBinPath so if /// the Python.Build.Tasks assembly is shadow copied it refers /// to the shadow copied assembly not the original. This - /// causes problems for python projects that refer to the + /// causes problems for Python projects that refer to the /// SharpDevelop.Python.Build.targets import via $(PythonBinPath) /// so here we change it so it points to the real PythonBinPath /// binary. /// public static void InitMSBuildEngine() { - // Remove existing PythonBinPath property. - MSBuildEngine.MSBuildProperties.Remove("PythonBinPath"); - - // Set the PythonBinPath property so it points to - // the actual bin path where the Python.Build.Tasks was built not - // to the shadow copy folder. - string codeBase = typeof(PythonParser).Assembly.CodeBase.Replace("file:///", String.Empty); - string folder = Path.GetDirectoryName(codeBase); - folder = Path.GetFullPath(Path.Combine(folder, @"..\..\AddIns\BackendBindings\PythonBinding\")); - MSBuildEngine.MSBuildProperties["PythonBinPath"] = folder; - } + string relativePath = @"..\..\AddIns\BackendBindings\PythonBinding\"; + MSBuildEngineHelper.InitMSBuildEngine("PythonBinPath", relativePath, typeof(PythonParser)); + } } } diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs index 596811fd14..55810b0fb0 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs @@ -45,7 +45,7 @@ namespace RubyBinding.Tests.Converter [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + RubyMSBuildEngineHelper.InitMSBuildEngine(); List bindings = new List(); using (TextReader reader = RubyBindingAddInFile.ReadAddInFile()) { diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj index 503d8e33b3..4e5862156d 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj @@ -340,8 +340,8 @@ - + diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs index 745fe9706f..8d3e23a2f3 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs @@ -24,7 +24,7 @@ namespace RubyBinding.Tests.Testing [TestFixtureSetUp] public void SetUpFixture() { - MSBuildEngineHelper.InitMSBuildEngine(); + RubyMSBuildEngineHelper.InitMSBuildEngine(); } [SetUp] diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/MSBuildEngineHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs similarity index 57% rename from src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/MSBuildEngineHelper.cs rename to src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs index 01dc04d03e..125bbb86df 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/MSBuildEngineHelper.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs @@ -8,13 +8,14 @@ using System; using System.IO; using ICSharpCode.RubyBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Project; namespace RubyBinding.Tests.Utils { - public sealed class MSBuildEngineHelper + public sealed class RubyMSBuildEngineHelper { - MSBuildEngineHelper() + RubyMSBuildEngineHelper() { } @@ -29,16 +30,8 @@ namespace RubyBinding.Tests.Utils /// public static void InitMSBuildEngine() { - // Remove existing RubyBinPath property. - MSBuildEngine.MSBuildProperties.Remove("RubyBinPath"); - - // Set the RubyBinPath property so it points to - // the actual bin path where the Ruby.Build.Tasks was built not - // to the shadow copy folder. - string codeBase = typeof(RubyParser).Assembly.CodeBase.Replace("file:///", String.Empty); - string folder = Path.GetDirectoryName(codeBase); - folder = Path.GetFullPath(Path.Combine(folder, @"..\..\AddIns\AddIns\BackendBindings\RubyBinding\")); - MSBuildEngine.MSBuildProperties["RubyBinPath"] = folder; + string relativePath = @"..\..\AddIns\BackendBindings\RubyBinding\"; + MSBuildEngineHelper.InitMSBuildEngine("RubyBinPath", relativePath, typeof(RubyParser)); } } } diff --git a/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj b/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj index 87c07edac6..98a2f9f10e 100644 --- a/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj +++ b/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj @@ -110,6 +110,7 @@ + diff --git a/src/AddIns/BackendBindings/Scripting/Test/Utils/MSBuildEngineHelper.cs b/src/AddIns/BackendBindings/Scripting/Test/Utils/MSBuildEngineHelper.cs new file mode 100644 index 0000000000..0cbcf4d12b --- /dev/null +++ b/src/AddIns/BackendBindings/Scripting/Test/Utils/MSBuildEngineHelper.cs @@ -0,0 +1,43 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.IO; +using ICSharpCode.Scripting; +using ICSharpCode.SharpDevelop.Project; + +namespace ICSharpCode.Scripting.Tests.Utils +{ + public sealed class MSBuildEngineHelper + { + MSBuildEngineHelper() + { + } + + /// + /// The MSBuildEngine sets theBinPath so if + /// the Build.Tasks assembly is shadow copied it refers + /// to the shadow copied assembly not the original. This + /// causes problems for python projects that refer to the + /// SharpDevelop.*.Build.targets import via $(BinPath) + /// so here we change it so it points to the real BinPath + /// binary. + /// + public static void InitMSBuildEngine(string binPathName, string addInRelativePath, Type typeForCodeBase) + { + MSBuildEngine.MSBuildProperties.Remove(binPathName); + + // Set the bin path property so it points to + // the actual bin path where the Build.Tasks was built not + // to the shadow copy folder. + string codeBase = typeForCodeBase.Assembly.CodeBase.Replace("file:///", String.Empty); + string folder = Path.GetDirectoryName(codeBase); + folder = Path.GetFullPath(Path.Combine(folder, addInRelativePath)); + MSBuildEngine.MSBuildProperties[binPathName] = folder; + } + } +}