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
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#:
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.
Luckily fixing this is very easy. Just go back to the ZIP file you downloaded, select properties, then “unblock” the content.
Then extract the contents and rerun it. Everything should work fine.