From 39cb4945841d0e838b97b0db76e7d2ccabed5bc6 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sat, 13 Jan 2007 17:52:41 +0000 Subject: [PATCH] Removed the ToolPath's Condition check from new WiX Projects (.wixproj). git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2293 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Project/WixProject.cs | 2 +- .../CreateNewWixProjectObjectTestFixture.cs | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs b/src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs index 5902e79f7e..c8be17cd9e 100644 --- a/src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs +++ b/src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs @@ -239,7 +239,7 @@ namespace ICSharpCode.WixBinding string wixToolPath = @"$(SharpDevelopBinPath)\Tools\Wix"; AddGuardedProperty("WixToolPath", wixToolPath, false); - AddGuardedProperty("ToolPath", "$(WixToolPath)", false); + SetProperty("ToolPath", "$(WixToolPath)", false); AddGuardedProperty("WixMSBuildExtensionsPath", wixToolPath, false); this.AddImport(DefaultTargetsFile, null); diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs index f7876d8bd2..310a8b0434 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs @@ -6,10 +6,12 @@ // using System; +using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Internal.Templates; using ICSharpCode.SharpDevelop.Project; using ICSharpCode.WixBinding; +using MSBuild = Microsoft.Build.BuildEngine; using NUnit.Framework; using WixBinding.Tests.Utils; @@ -81,18 +83,39 @@ namespace WixBinding.Tests.Project Assert.AreEqual(@"$(SharpDevelopBinPath)\Tools\Wix", project.GetUnevalatedProperty("WixToolPath")); } + [Test] + public void WixToolPathCondition() + { + MSBuild.BuildProperty property = GetMSBuildProperty("WixToolPath"); + Assert.AreEqual(" '$(WixToolPath)' == '' ", property.Condition); + } + [Test] public void ToolPath() { Assert.AreEqual(@"$(WixToolPath)", project.GetUnevalatedProperty("ToolPath")); } + [Test] + public void ToolPathHasNoCondition() + { + MSBuild.BuildProperty property = GetMSBuildProperty("ToolPath"); + Assert.IsTrue(String.IsNullOrEmpty(property.Condition), "ToolPath should not have a condition: " + property.Condition); + } + [Test] public void WixMSBuildExtensionsPath() { Assert.AreEqual(@"$(SharpDevelopBinPath)\Tools\Wix", project.GetUnevalatedProperty("WixMSBuildExtensionsPath")); } + [Test] + public void WixMSBuildExtensionsPathCondition() + { + MSBuild.BuildProperty property = GetMSBuildProperty("WixMSBuildExtensionsPath"); + Assert.AreEqual(" '$(WixMSBuildExtensionsPath)' == '' ", property.Condition); + } + [Test] public void DebugConfiguration() { @@ -122,5 +145,22 @@ namespace WixBinding.Tests.Project { Assert.AreEqual(LanguageProperties.None, project.LanguageProperties); } + + /// + /// Gets the MSBuild build property with the specified name from the WixProject. + /// + MSBuild.BuildProperty GetMSBuildProperty(string name) + { + MSBuild.Project msbuildProject = project.MSBuildProject; + foreach (MSBuild.BuildPropertyGroup g in Linq.ToList(Linq.CastTo(msbuildProject.PropertyGroups))) { + if (!g.IsImported) { + MSBuild.BuildProperty property = MSBuildInternals.GetProperty(g, name); + if (property != null) { + return property; + } + } + } + return null; + } } }