}
}
+ [Test]
+ public void TestMSBuildThisProperties ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project project = engine.CreateNewProject ();
+
+ string base_dir = Path.GetFullPath (Path.Combine ("Test", "resources")) + Path.DirectorySeparatorChar;
+ string tmp_dir = Path.GetFullPath (Path.Combine (base_dir, "tmp")) + Path.DirectorySeparatorChar;
+
+ string first_project = Path.Combine (base_dir, "first.proj");
+ string second_project = Path.Combine (tmp_dir, "second.proj");
+ string third_project = Path.Combine (tmp_dir, "third.proj");
+
+ string first = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInMain>$(MSBuildThisFileDirectory)</FooInMain>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInMain Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+ <Import Project=""tmp\second.proj""/>
+ </Project>";
+
+ string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInImport1>$(MSBuildThisFileDirectory)</FooInImport1>
+ </PropertyGroup>
+ <PropertyGroup>
+ <FooInImport2>$(MSBuildThisFileDirectory)</FooInImport2>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInImport1 Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+
+ <Import Project=""third.proj""/>
+ </Project>";
+
+ string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInTwo>$(MSBuildThisFileFullPath)</FooInTwo>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInTwo Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+
+ <Target Name=""TargetInTwo"">
+ <Message Text=""FooInMain: $(FooInMain)""/>
+ <Message Text=""FooInImport1: $(FooInImport1)""/>
+ <Message Text=""FooInImport2: $(FooInImport2)""/>
+ <Message Text=""FooInTwo: $(FooInTwo)""/>
+
+ <Message Text=""ItemInMain: %(ItemInMain.Identity)""/>
+ <Message Text=""ItemInImport1: %(ItemInImport1.Identity)""/>
+ <Message Text=""ItemInTwo: %(ItemInTwo.Identity)""/>
+ <Message Text=""Full path: $(MSBuildThisFileFullPath)""/>
+ </Target>
+ </Project>";
+
+ File.WriteAllText (first_project, first);
+
+ Directory.CreateDirectory (Path.Combine (base_dir, "tmp"));
+ File.WriteAllText (second_project, second);
+ File.WriteAllText (third_project, third);
+
+ MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
+ new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
+ engine.RegisterLogger (logger);
+
+ project.Load (first_project);
+ try {
+ Assert.IsTrue (project.Build (), "Build failed");
+
+ logger.CheckLoggedMessageHead ("FooInMain: " + base_dir, "A1");
+ logger.CheckLoggedMessageHead ("FooInImport1: " + tmp_dir, "A2");
+ logger.CheckLoggedMessageHead ("FooInImport2: " + tmp_dir, "A3");
+ logger.CheckLoggedMessageHead ("FooInTwo: " + third_project, "A4");
+ logger.CheckLoggedMessageHead ("ItemInMain: " + first_project, "A5");
+ logger.CheckLoggedMessageHead ("ItemInImport1: " + second_project, "A6");
+ logger.CheckLoggedMessageHead ("ItemInTwo: " + third_project, "A7");
+ logger.CheckLoggedMessageHead ("Full path: " + third_project, "A8");
+
+ Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
+ } catch {
+ logger.DumpMessages ();
+ throw;
+ } finally {
+ File.Delete (first_project);
+ File.Delete (second_project);
+ File.Delete (third_project);
+ }
+ }
[Test]
public void TestRequiredTask_String1 ()