SpriteHand
Module Border
  VS2010: The "ValidateXaml" task failed unexpectedly
Module Border
Location: BlogsAndy's Blog    
Posted by: host 2/11/2010 9:18 AM


As you're moving all of your Silverlight solutions into Visual Studio 2010, you might encounter an error on compile like so:

System.IO.FileLoadException: Could not load file or assembly 'file:///C:\dev\Silverlight\xxx\yyy.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\dev\Silverlight\xxx\yyy.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

This error is due to referencing one or more assemblies that were downloaded from the web and perhaps extracted from a ZIP file - things such as third party controls. These assembly files have a "block" flag set on them for security.

There are a couple of ways around this:

  1. To do a one time fix for the assemblies that are firing this error, find the assembly in Windows Explorer and right-click and select Properties. Click the "Unblock" button at the bottom right of the "General" tab.

  2. UPDATE 2/11/2010: I just learned from Mark Boulter (Microsoft) that the following tweak might not be a good idea, so use at your own risk. In fact, any tweaks to devenv.exe.config are not a good idea. Anyway, I'll leave this info up in case anyone is feeling frisky.

    You can also permanently disable this security check in Visual Studio 2010. Open the VS2010 config file at this location:

     %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config

    ...and add the following under the <CONFIGURATION> element:

     <runtime>
      <loadFromRemoteSources enabled="true" />
     </runtime>


Permalink |  Trackback

Comments (13)   Add Comment
Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 2/18/2010 8:51 PM
Thank you. I used option 1 and that fixed my problem

Cris Perry

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 3/15/2010 4:26 PM
Thanks for this suggestion. I too used Option 1 and it worked for me as well.

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 4/6/2010 5:36 AM
thx - this saved me hours!

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 5/4/2010 9:10 AM
Thx a lot - saved me hours

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 5/14/2010 11:05 AM
I was unable to find the "Unblock" button. I'm using Windows 7 Ultimate. I did step 2 for now. Any idea how to get the "Unblock" button to appear? I'm right clicking on the dll that the error says it can't load and selecting Properties.

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 5/19/2010 5:29 AM
thanks - I got away with that error

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 6/4/2010 5:47 AM
Hey Andy,
Thank you very much dear...

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 7/2/2010 2:18 PM
Got same error, but not due to locked dlls. I was simply trying to build a project residing entirely on a network drive. The only work-around that worked was to:
"disable the ValidateXaml task for your Silverlight app by editing the project file and changing the value of the element to false". Maybe Andy can add it as #3 solution.

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 7/19/2010 3:07 PM
Thanks, editing the project file and disabling the ValidateXaml key did the trick

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 7/23/2010 3:14 AM
After I do that I am still getting a broken dll in the References folder of PhysicsBehaviors.Silverlight.dll in the PhysicsBehaviors.Design.Silverlight. Where can I download that dll?

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 8/30/2010 4:02 AM
opened the project from network share
\\mycomp1\project1\test.sln
FAILED

opened the project from local drive
D:\project1\test.sln
PASSED

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 9/24/2010 2:50 AM
Option1 worked.Thanks a lot :)

Re: VS2010: The "ValidateXaml" task failed unexpectedly    By Anonymous on 8/10/2011 11:43 PM
Option #1 did not resolve the problem for me. How does one identify any assembly that needs to be unblocked. I am aware that I can unblock an assembly before installation, but what about afterwards? What do we do then if option #1 fails to resolve the error?


Title:
Comment:
Add Comment   Cancel 
Module Border Module Border
Module Border
  Subscribe
Module Border
RSS   Twitter
Module Border Module Border
Module Border
  Diversions
Module Border

TALKING RAGDOLL
This Windows Phone 7 App was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!

MORE INFO



DROPPYPOP
This Windows Phone 7 game was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine.
DEMO

MORE INFO



BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight 2, the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight 2.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight 2.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2013 andy.beaulieu.com - Login