Could not load file or assembly System.EnterpriseServices compile error in ASP.NET

I have been receiving this error recently with a web site I was developing. Its rather weird because I am not using it nor had I any reference to System.EnterpriseServices or anything else that might have. In fact the web site was new so didn’t have much of a reference to anything except the default assemblies. Well a little searching turned up that the there was a reference to the System.EnterpriseServices assembly in the web.config located in the “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG” folder.

 

How it got there? I can only assume it’s the result of recently installing the Microsoft Enterprise Library. Now that was about a weeks ago but its quite possible that I didn’t do any other ASP.NET development since. Whatever the cause was, if you receive the same error that is one thing you might want to check.

 

Enjoy!

Maurice de Beijer
 

10 thoughts on “Could not load file or assembly System.EnterpriseServices compile error in ASP.NET

  1. Yes that works. However I don’t really want to add a reference to an assembly I have no intentions of using to a project and start distributing it with my solution to customers.

  2. Adding a reference to System.EnterpriseServices only fixes the compile problem. You will still get a run-time issue as this answer does not correct the root problem. I’m still looking for a solution.

  3. Thank you so much Maurice for this post. As you suggested, I removed the entry from web.config in the CONFIG folder. I also removed it from web.config.comments (I believe that is the file name). I finally removed the entry from my project’s web.config. This finally resolved my issue with this project and when creating new projects.

  4. Hi!

    Other solution: drag the System.DirectoryServices assembly from your current .net framework directory to the GAC.

    It worked for me, but I still don’t know why this problem came up…

  5. Neither of these solutions worked.

    Fixed the problem by repairing visual studio via Add/Remove programs in control panel.

    …bloody microsoft

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>