diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2014-06-02 11:47:38 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2014-06-02 12:59:29 +0400 |
commit | c29ae4c3e1bb5f62a243080898002cd6623ce92d (patch) | |
tree | 07b1797c79cc9e8be88449fb44ce91ff4709aac3 /mcs/class/Microsoft.Build/Test | |
parent | 756f3740c2f4d8c7767099b485c4f719251da0da (diff) |
[MS.Build] added test for ToolLocationHelper.GetPathToStandardLibraries() to add target item.
It should be used in Microsoft.CSharp.targets to pass the path to mscorlib.dll
but it's not working yet, so I'm making it to work step by step.
Diffstat (limited to 'mcs/class/Microsoft.Build/Test')
-rw-r--r-- | mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs index c7a736436f6..6ee4cfe24c6 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs @@ -309,6 +309,37 @@ namespace MonoTests.Microsoft.Build.Execution Assert.IsNotNull (p, "#1"); Assert.AreEqual (";_AddCorlibReference", p.EvaluatedValue, "#2"); } + + [Test] + public void ItemsInTargets () + { + string project_xml = @"<Project DefaultTargets='Default' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> + <Target Name='Default'> + <PropertyGroup> + <_ExplicitMSCorlibPath>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries ('$(TargetFrameworkIdentifier)', '$(TargetFrameworkVersion)', '$(TargetFrameworkProfile)'))\mscorlib.dll</_ExplicitMSCorlibPath> + </PropertyGroup> + <ItemGroup> + <_ExplicitReference + Include='$(_ExplicitMSCorlibPath)' + Condition='Exists($(_ExplicitMSCorlibPath))'> + <Private>false</Private> + </_ExplicitReference> + </ItemGroup> + </Target> + <Import Project='$(MSBuildBinPath)\\Microsoft.CSharp.targets' /> +</Project>"; + var xml = XmlReader.Create (new StringReader (project_xml)); + var root = ProjectRootElement.Create (xml); + root.FullPath = "ProjectInstanceTest.ConditionalExpression.proj"; + var proj = new ProjectInstance (root, null, "4.0", ProjectCollection.GlobalProjectCollection); + proj.Build (); + // make sure the property value expansion is done successfully. + Assert.IsTrue (!string.IsNullOrEmpty (proj.GetPropertyValue ("_ExplicitMSCorlibPath")), "premise: propertyValue by ToolLocationHelper func call"); + var items = proj.GetItems ("_ExplicitReference"); + // make sure items are stored after build. + Assert.IsTrue (items.Any (), "items.Any"); + Assert.IsTrue (!string.IsNullOrEmpty (items.First ().EvaluatedInclude), "item.EvaluatedInclude"); + } } namespace SubNamespace |