This project has moved. For the latest updates, please go here.

[Info] WPF Design Time and Internet Security

Jun 3, 2014 at 6:12 PM
Edited May 14, 2016 at 7:34 PM

This article has been moved to GitHub!

If you download a Visual Studio solution (source code) from the Internet then you might see the following error message. This message comes from the WPF designer when you open a WPF Xaml view.

Xaml Design Window: Invalid Markup

Output Window (Show output from: General):
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 for more information.
The message is misleading because the Designer does not attempt to load an assembly from a network location. Instead, all files downloaded from the internet are marked by Windows as 'Blocked' files. It seems that the WPF Xaml Designer is not able to load assemblies that were 'Blocked' by Windows.

The blocked assemblies can be Unblocked by the Properties Window of the Windows Explorer.


However, every file has to be unblocked separately. If the downloaded source code consists of much files then unblocking with the Explorer is no fun at all. The PowerShell v3 introduced a command to unblock files. This way it is possible to unblock all files of a VS solution at once:
Get-ChildItem –recurse C:\Dev\FileHashGenerator | Unblock-File
Windows 7 comes with PowerShell v2 which does not know this command. Microsoft provides a download to install PowerShell v3 on Windows 7.