diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs index e5f54caaff..12ef9c5484 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs @@ -504,20 +504,24 @@ namespace Xamarin.iOS.Tasks plist.SetMinimumOSVersion ("7.0"); plist.Save (path, true); - var projectInstance = project.CreateProjectInstance (); - RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0); + ProjectInstance projectInstance = null; + try { + projectInstance = project.CreateProjectInstance (); + RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0); - var bundleItemsNoAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); - Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#1"); + var bundleItemsNoAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); + Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#1"); - project = SetupProject (Engine, MonoTouchProjectCSProjPath); - projectInstance = project.CreateProjectInstance (); + project = SetupProject (Engine, MonoTouchProjectCSProjPath); + projectInstance = project.CreateProjectInstance (); - // Put a thread.sleep so that we get noticeable timestamps. - EnsureFilestampChange (); + // Put a thread.sleep so that we get noticeable timestamps. + EnsureFilestampChange (); - // Re-save the original plist (adding app icon). - plistCopy.Save (path, true); + } finally { + // Re-save the original plist (adding app icon). + plistCopy.Save (path, true); + } // Re-run the task with app icon set this time and no clean. // The task should be aware the app icon is now being used. diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs index 42a71681f2..371413be0e 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs @@ -55,6 +55,13 @@ namespace Xamarin.iOS.Tasks CompiledPlist = PDictionary.FromFile (Task.CompiledAppManifest.ItemSpec); } + public override void Teardown () + { + base.Teardown (); + + Directory.Delete ("AppBundlePath", true); + } + #region General tests [Test] public void PlistMissing ()