This one will need a bit of explanation...
I want to set up IIS automagically so our Integration tests (using Watin) can run on any environment. To that end I want to create a Setup and Teardown that will create and destroy a virtual directory respectively.
The solution I thought of was to use the MSBuild Community Tasks to automate IIS in code with a mocked IBuildEngine.
However, when I try to create a virtual directory, I get the following error code: 0x80005008. Edit: I removed artifacts from earlier attemps, and now I get an IndexOutOfRangeException
I'm on Vista with IIS7. This is the code I'm using to run the task:
var buildEngine = new MockedBuildEngine();
buildEngine.OnError += (o, e) => Console.WriteLine("ERROR" + e.Message);
buildEngine.OnMessage += (o, e) => Console.WriteLine("MESSAGE" + e.Message);
buildEngine.OnWarning += (o, e) => Console.WriteLine("WARNING: " + e.Message);
var createWebsite = new MSBuild.Community.Tasks.IIS.WebDirectoryCreate()
{
ServerName = "localhost",
VirtualDirectoryPhysicalPath = websiteFolder.FullName,
VirtualDirectoryName = "MedicatiebeheerFittests",
AccessRead = true,
AuthAnonymous = true,
AnonymousPasswordSync = false,
AuthNtlm = true,
EnableDefaultDoc = true,
BuildEngine = buildEngine
};
createWebsite.Execute();
Somebody knows what is going on here? Or does someone know a better way of doing this?