Visual Studio Project Sample Loading Error: Assembly could not be loaded and will be ignored. Could not load file or assembly or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Posted by: Brad Abrams on 12/11/2009

Some folks have mentioned to me that they are having trouble getting some of my samples to work.  And in fact, just the other day, I ran into a problem getting my own samples to work.  It turns out to be a problem with the way windows treats the sample that you down load.

Specifically, because you downloaded the sample from the internet, windows treats the sample as “untrusted” content.  When you unzip untrusted content you get a directory full of untrusted content.  Visual Studio is not so good and running untrusted content.  Unfortunately, you get some really bad error messages like the one above.

Here is the error message from VB

image

Warning    1    Assembly 'C:\Users\brada\Desktop\MyApp.VB\MyApp.VB.Web\bin\MyApp.VB.Web.dll' could not be loaded and will be ignored.
Could not load file or assembly 'file:///C:\Users\brada\Desktop\MyApp.VB\MyApp.VB.Web\bin\MyApp.VB.Web.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)    MyApp.VB

 

And here is the message from C#:

image

Warning    1    Assembly 'C:\Users\brada\Desktop\MyApp.Starter\MyApp.Web\bin\MyApp.Web.dll' could not be loaded and will be ignored.
Could not load file or assembly 'file:///C:\Users\brada\Desktop\MyApp.Starter\MyApp.Web\bin\MyApp.Web.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)    MyApp

 

Notice these are warnings, so if you are only looking at errors, you will be even more confused. 

 

There is at least a good warning when the project is being loaded.     I am not sure why you are giving the option to continue here, because there are very few projects that will just work in the semi-trusted way.  If you see this, hit cancel and fix the issue first. 

image

 

Luckily fixing this is very easy.  Just go back to the ZIP file you downloaded, select properties, then “unblock” the content. 

image

 

 

 

 

 

Then extract the contents and rerun it.  Everything should work fine.

 

Good luck!


About Brad Abrams

Brad Abrams

Brad Abrams was a founding member of both the Common Language Runtime, and .NET Framework teams at Microsoft Corporation where he is currently the Group Program Manager for the UI Framework and Services team which is responsible for delivering the developer platform that spans both clients and web based applications as well as the common services that are available to all applications. Specific technologies owned by this team include ASP.NET, Atlas, and Windows Forms.

Brad has been designing parts of the .NET Framework since 1998 when he started his framework design career building the BCL (Base Class Library) that ship as a core part of the .NET Framework. Brad was also the lead editor on the Common Language Specification (CLS), the .NET Framework Design Guidelines and the libraries in the ECMA\ISO CLI Standard. Brad has been deeply involved with the WinFX and Windows Vista efforts from their beginning

Brad co-authored Programming in the .NET Environment, and was editor on .NET Framework Standard Library Annotated Reference Vol1 and Vol2 and the Framework Design Guidelines

More About Brad »

NFJS, the Magazine

December Issue Now Available
  • BDD and REST

    by Brian Sletten
  • Mocks and Stubs in Groovy Tests

    by Kenneth Kousen
  • Algorithms for Better Text Search Results

    by John Griffin
  • Knowns and Unknowns of Scrum and Agile

    by Brian Tarbox
Learn More »