Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Schema import fails with Request for the permission of type System.Net.WebPermission

In Visual Studio 2010 SP1, I have an XML Schema (XSD) file open with the following lines:

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
           schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>

xs:import has a wavy blue line under it, and when you hover over it, you get the following tool tip:

Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

How do I grant this permission so it can download the schema? Thanks.

Update: I forgot to mention this in my original post, but I've already reviewed Craig Watson's workaround. It defeats the purpose of having Visual Studio "automatically download DTDs and schemas" (Tools > Options > Text Editor > XML > Miscellaneous). I'm hoping for a solution rather than a workaround. Thanks.

like image 870
jordanbtucker Avatar asked Feb 01 '12 19:02

jordanbtucker


1 Answers

(I know it's an old question. Since there's no accepted answer, I've decided to add this one anyway.)

This issue is answered at this question's answer.

All you need to do is edit the file's properties in Windows Explorer and unblock the downloaded file. That's what's causing the permissions exception: it's a downloaded (and thus untrusted) file.

like image 169
Joep Beusenberg Avatar answered Oct 14 '22 13:10

Joep Beusenberg