Could not load file or assembly 'Microsoft.Practices.ObjectBuilder... RRS feed

  • Question


    I get a runtime error when on the following line of code ...

    Database db = DatabaseFactory.CreateDatabase(AppData.Environment);



    Exception :

    {"The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception."}


    Inner Exception

    "Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied."


    This was working a few days ago and now it's not. Others on my team are able to get the solution and it runs fine on their machines. I tried un/reinstalling the Enterprise libraries. I've also checked the 'Copy Local' and it's set to true. I've done the brain-dead reboot, close project/reopen, etc. Nothing seems to work any ideas?
    Wednesday, January 23, 2008 2:46 AM

All replies

  • I was able to get rid of the run-time-error by adding 'everyone' user to the directory where my project is as well as where the Enterprise libraries are installed. I can't say why this worked, or why it ever stopped working in the first place.
    Friday, January 25, 2008 3:36 AM
  • Hey,

    It could be a permission issue or the needed dlls themselves are not present or removed from the location. So in your case, the folder where the enterprise library dlls are present were not accessible to the identity of the logged on user.

    -Mohammed Ghouse Ibne Barq Kadapavi
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.

    Mohammed Ghouse Ibne Barq Kadapavi
    Monday, May 16, 2011 10:21 AM