Could not load file or assembly CassiniDev-lib

Nov 27, 2014 at 6:41 PM
Edited Nov 27, 2014 at 6:43 PM
OS: Windows 8.1 enterprise 32 bit English

When it ran in-proc, I got exception:

Could not load file or assembly 'CassiniDev-lib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=8f1b6268456057e5' or one of its dependencies. The system cannot find the file specified.

It worked for some machine though, the exception seems to get thrown out by this method:
    /// <summary>
    /// 
    /// </summary>
    /// <param name="virtualPath"></param>
    /// <param name="physicalPath"></param>
    /// <param name="hostType"></param>
    /// <param name="port"></param>
    /// <returns></returns>
    /// <remarks>
    /// This is Dmitry's hack to enable running outside of GAC.
    /// There are some errors being thrown when running in proc
    /// </remarks>
    private object CreateWorkerAppDomainWithHost(string virtualPath, string physicalPath, Type hostType,int port)
    {
        // create BuildManagerHost in the worker app domain
        //ApplicationManager appManager = ApplicationManager.GetApplicationManager();
        Type buildManagerHostType = typeof(HttpRuntime).Assembly.GetType("System.Web.Compilation.BuildManagerHost");
        IRegisteredObject buildManagerHost = ApplicationManager.CreateObject(_appId, buildManagerHostType, virtualPath,
                                                                      physicalPath, false);

        // call BuildManagerHost.RegisterAssembly to make Host type loadable in the worker app domain
        buildManagerHostType.InvokeMember("RegisterAssembly",
                                          BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic,
                                          null,
                                          buildManagerHost,
                                          new object[] { hostType.Assembly.FullName, hostType.Assembly.Location });

        // create Host in the worker app domain
        // FIXME: getting FileLoadException Could not load file or assembly 'WebDev.WebServer20, Version=4.0.1.6, Culture=neutral, PublicKeyToken=f7f6e0b4240c7c27' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
        // when running dnoa 3.4 samples - webdev is registering trust somewhere that we are not
        return ApplicationManager.CreateObject(_appId, hostType, virtualPath, physicalPath, false);
    }

The comments in the source code indicate that there are some unsolved issues, and I wonder are there any updates related to this? In our case, the last line threw exception. Thanks!