29

I have opened a 3rd party XSD file in Visual Studio 2010 that imports namespaces from other schema files from the same 3rd party.

In the XML editor view of the schema file, the xs:import element is underlined with the following error: Request for the permission of type 'System.Security.Permissions.FileIOPermission', mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I read the following blog post: Link which states that it's a security zone violation and Visual Studio places the schemas in the "Unauthorized zone" in the XML Schema Explorer.

My question is - how do I change my security settings to allow these schemas to be referenced, or is there something I can do to make the schemas and namespaces associated with them "trusted"?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
mrmcderm
  • 461
  • 1
  • 5
  • 7

3 Answers3

47

Had this issue myself - it was actually because Win 7 had blocked the schema files due to them being copied in from a network location.

To unblock individual files navigate to the file and use Properties > Unblock enter image description here

For multiple files it's quickest to use Sysinternals' Streams to bulk change the location as described in this blog post.

Nate Anderson
  • 18,334
  • 18
  • 100
  • 135
AndyWilson
  • 909
  • 7
  • 11
  • Thank you... I thought I'm gonna pull my hair out trying to figure out what's going on. Happend to me on Win 10 with VS 2017... I've downloaded some schemas the way I usually did and this time Windows marked them as external sources (probably after recent security update). The cause was probably an unsecure url (http) – PiWo Dec 19 '21 at 16:49
9

Use Powershell command prompt:

Get-Item "C:\<path to folder with blocked files>\*\*.*" | Unblock-File

https://technet.microsoft.com/en-us/library/hh849924.aspx

OzBob
  • 4,227
  • 1
  • 39
  • 48
0

I had the same situation that I did not have unblock button. In my case helped the following If Windows policy does not allow to unlock.

  1. Try to archive the file eg. with 7zip in local drive (but not any shared drive and not directory of Onedrive/Dropbox/etc.. because those soft can add zones to files depending on system configuration).
  2. Then unpack the archive to another local directory
  3. File now should be without unauthorized zone.
essential
  • 648
  • 1
  • 7
  • 19
  • FWIW, I've tried *every* other possible suggestion across many post to fix this issue (unblock, restart, run as admin, etc), and this turned out to be the only one that worked. Add whole dir to 7z archive.. move where I needed it, extract 7z. Open .xsd in VS, *poof*, all externally referenced .xsd's imported without issue. – Daemon42 Oct 20 '22 at 18:17