|
|
|
@ -5,6 +5,7 @@
@@ -5,6 +5,7 @@
|
|
|
|
|
// <version>$Revision$</version>
|
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
using Microsoft.Build.Construction; |
|
|
|
|
using System; |
|
|
|
|
using System.Linq; |
|
|
|
|
using ICSharpCode.SharpDevelop; |
|
|
|
@ -12,7 +13,6 @@ using ICSharpCode.SharpDevelop.Dom;
@@ -12,7 +13,6 @@ 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; |
|
|
|
|
|
|
|
|
@ -68,17 +68,10 @@ namespace WixBinding.Tests.Project
@@ -68,17 +68,10 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
[Test] |
|
|
|
|
public void Imports() |
|
|
|
|
{ |
|
|
|
|
// this is machine-dependent, it's possible that additional imports are loaded
|
|
|
|
|
//Assert.AreEqual(2, project.MSBuildProject.Imports.Count);
|
|
|
|
|
Microsoft.Build.BuildEngine.Import[] imports = new Microsoft.Build.BuildEngine.Import[project.MSBuildProject.Imports.Count]; |
|
|
|
|
project.MSBuildProject.Imports.CopyTo(imports, 0); |
|
|
|
|
|
|
|
|
|
string[] paths = new string[imports.Length]; |
|
|
|
|
for (int i = 0; i < imports.Length; i++) { |
|
|
|
|
paths[i] = imports[i].ProjectPath; |
|
|
|
|
lock (project.SyncRoot) { |
|
|
|
|
Assert.AreEqual(1, project.MSBuildProjectFile.Imports.Count()); |
|
|
|
|
Assert.AreEqual(WixProject.DefaultTargetsFile, project.MSBuildProjectFile.Imports.Single().Project); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Assert.Contains(WixProject.DefaultTargetsFile, paths); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
@ -90,7 +83,7 @@ namespace WixBinding.Tests.Project
@@ -90,7 +83,7 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
[Test] |
|
|
|
|
public void WixToolPathCondition() |
|
|
|
|
{ |
|
|
|
|
MSBuild.BuildProperty property = GetMSBuildProperty("WixToolPath"); |
|
|
|
|
ProjectPropertyElement property = GetMSBuildProperty("WixToolPath"); |
|
|
|
|
Assert.AreEqual(" '$(WixToolPath)' == '' ", property.Condition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -99,13 +92,13 @@ namespace WixBinding.Tests.Project
@@ -99,13 +92,13 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
{ |
|
|
|
|
Assert.IsNull(project.GetUnevalatedProperty("ToolPath")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void WixMSBuildExtensionsPathShouldNotExist() |
|
|
|
|
{ |
|
|
|
|
Assert.IsNull(project.GetUnevalatedProperty("WixMSBuildExtensionsPath")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void WixTargetsPath() |
|
|
|
|
{ |
|
|
|
@ -115,7 +108,7 @@ namespace WixBinding.Tests.Project
@@ -115,7 +108,7 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
[Test] |
|
|
|
|
public void WixTargetsPathCondition() |
|
|
|
|
{ |
|
|
|
|
MSBuild.BuildProperty property = GetMSBuildProperty("WixTargetsPath"); |
|
|
|
|
ProjectPropertyElement property = GetMSBuildProperty("WixTargetsPath"); |
|
|
|
|
Assert.AreEqual(" '$(WixTargetsPath)' == '' ", property.Condition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -128,7 +121,7 @@ namespace WixBinding.Tests.Project
@@ -128,7 +121,7 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
[Test] |
|
|
|
|
public void WixTasksPathCondition() |
|
|
|
|
{ |
|
|
|
|
MSBuild.BuildProperty property = GetMSBuildProperty("WixTasksPath"); |
|
|
|
|
ProjectPropertyElement property = GetMSBuildProperty("WixTasksPath"); |
|
|
|
|
Assert.AreEqual(" '$(WixTasksPath)' == '' ", property.Condition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -165,15 +158,12 @@ namespace WixBinding.Tests.Project
@@ -165,15 +158,12 @@ namespace WixBinding.Tests.Project
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the MSBuild build property with the specified name from the WixProject.
|
|
|
|
|
/// </summary>
|
|
|
|
|
MSBuild.BuildProperty GetMSBuildProperty(string name) |
|
|
|
|
{ |
|
|
|
|
MSBuild.Project msbuildProject = project.MSBuildProject; |
|
|
|
|
foreach (MSBuild.BuildPropertyGroup g in msbuildProject.PropertyGroups.Cast<MSBuild.BuildPropertyGroup>().ToList()) { |
|
|
|
|
if (!g.IsImported) { |
|
|
|
|
MSBuild.BuildProperty property = MSBuildInternals.GetProperty(g, name); |
|
|
|
|
if (property != null) { |
|
|
|
|
return property; |
|
|
|
|
} |
|
|
|
|
ProjectPropertyElement GetMSBuildProperty(string name) |
|
|
|
|
{ |
|
|
|
|
foreach (ProjectPropertyGroupElement g in project.MSBuildProjectFile.PropertyGroups) { |
|
|
|
|
foreach (ProjectPropertyElement element in g.Properties) { |
|
|
|
|
if (element.Name == name) |
|
|
|
|
return element; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|