diff --git a/Orchard.proj b/Orchard.proj
index b907eb655..baa1d2e7b 100644
--- a/Orchard.proj
+++ b/Orchard.proj
@@ -42,6 +42,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -56,11 +72,7 @@
-
-
-
-
@@ -319,7 +331,7 @@
-
+
@@ -330,7 +342,7 @@
-
+
diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
index 9fbdb6964..789634633 100644
--- a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
+++ b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config
@@ -44,8 +44,6 @@
-
-
-
+
diff --git a/src/Orchard.Specs/Hosting/WebHost.cs b/src/Orchard.Specs/Hosting/WebHost.cs
index a601b83c3..aea2a4f50 100644
--- a/src/Orchard.Specs/Hosting/WebHost.cs
+++ b/src/Orchard.Specs/Hosting/WebHost.cs
@@ -1,5 +1,9 @@
using System;
+using System.Diagnostics;
+using System.Linq;
using System.Reflection;
+using System.Threading;
+using System.Web;
using System.Web.Hosting;
using Orchard.Specs.Util;
using Path = Bleroy.FluentPath.Path;
@@ -10,6 +14,7 @@ namespace Orchard.Specs.Hosting {
private WebHostAgent _webHostAgent;
private Path _tempSite;
private Path _orchardWebPath;
+ private Path _codeGenDir;
public WebHost(Path orchardTemp) {
_orchardTemp = orchardTemp;
@@ -60,6 +65,17 @@ namespace Orchard.Specs.Hosting {
_webHostAgent = (WebHostAgent)ApplicationHost.CreateApplicationHost(typeof(WebHostAgent), VirtualDirectory, PhysicalDirectory);
+ var shuttle = new Shuttle();
+ Execute(() => { shuttle.CodeGenDir = HttpRuntime.CodegenDir; });
+
+ // ASP.NET folder seems to be always nested into an empty directory
+ _codeGenDir = shuttle.CodeGenDir;
+ _codeGenDir = _codeGenDir.Parent;
+ }
+
+ [Serializable]
+ class Shuttle {
+ public string CodeGenDir;
}
public void Dispose() {
@@ -71,10 +87,42 @@ namespace Orchard.Specs.Hosting {
}
public void Clean() {
+ // Try to delete temporary files for up to ~1.2 seconds.
+ for (int i = 0; i < 4; i++) {
+ Trace.WriteLine("Waiting 300msec before trying to delete temporary files");
+ Thread.Sleep(300);
+
+ if (TryDeleteTempFiles()) {
+ Trace.WriteLine("Successfully deleted all temporary files");
+ break;
+ }
+ }
+ }
+
+ private bool TryDeleteTempFiles() {
+ var result = true;
+ if (_codeGenDir != null && _codeGenDir.Exists) {
+ Trace.WriteLine(string.Format("Trying to delete temporary files at '{0}", _codeGenDir));
+ try {
+ _codeGenDir.Delete(true); // <- clean as much as possible
+ }
+ catch(Exception e) {
+ Trace.WriteLine(string.Format("failure: '{0}", e));
+ result = false;
+ }
+ }
+
+ if (_tempSite != null && _tempSite.Exists)
try {
+ Trace.WriteLine(string.Format("Trying to delete temporary files at '{0}", _tempSite));
_tempSite.Delete(true); // <- progressively clean as much as possible
}
- catch { }
+ catch (Exception e) {
+ Trace.WriteLine(string.Format("failure: '{0}", e));
+ result = false;
+ }
+
+ return result;
}
public void CopyExtension(string extensionFolder, string extensionName, ExtensionDeploymentOptions deploymentOptions) {
diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature
index 1ff0fa79f..8890a98a0 100644
--- a/src/Orchard.Specs/MultiTenancy.feature
+++ b/src/Orchard.Specs/MultiTenancy.feature
@@ -3,7 +3,6 @@
As a root Orchard system operator
I want to create and manage tenant configurations
-@ignore
Scenario: Default site is listed
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
@@ -115,7 +114,6 @@ Scenario: An existing initialized tenant cannot have its database option cleared
And I should see "Scott
"
And I should not see "Allow the tenant to set up the database"
-@ignore
Scenario: Default tenant cannot be disabled
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
@@ -166,7 +164,6 @@ Scenario: A running tenant which is disabled can be enabled
And I am redirected
Then I should see "