Discussing how Microsoft Dynamics Improves an Organization's Operations.

Microsoft Dynamics

Subscribe to Microsoft Dynamics : eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Microsoft Dynamics : homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Microsoft Dynamics Authors: Yeshim Deniz, Tim Park, Karen Miranda, Derek Harris, Dana Gardner

Related Topics: RIA Developer's Journal, Azure Cloud on Ulitzer, Microsoft Dynamics , Microsoft Developer, Telecom Innovation

Blog Post

Visual Studio Project Sample Loading Error

Assembly could not be loaded and will be ignored

Visual Studio at Cloud Expo

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!

Read the original blog entry...

More Stories By Brad Abrams

Brad Abrams is currently the Group Program Manager for the UI Framework and Services team at Microsoft which is responsible for delivering the developer platform that spans both client 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. He was a founding member of both the Common Language Runtime, and .NET Framework teams.

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 ships as a core part of the .NET Framework. He was also the lead editor on the Common Language Specification (CLS), the .NET Framework Design Guidelines, the libraries in the ECMA\ISO CLI Standard, and has been deeply involved with the WinFX and Windows Vista efforts from their beginning.

He co-authored Programming in the .NET Environment, and was editor on .NET Framework Standard Library Annotated Reference Vol 1 and Vol 2 and the Framework Design Guidelines.