Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Unauthorized zone" mean when browsing xsd files with Visual Studio 2010?

When I open up an xsd file that includes other xsd files, all of the included files are added to a section called "Unauthorized zone". Visual Studio highlights the xs:include element and gives the following error when trying to resolve the schemaLocation attribute:

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I've read the following blog post, but I'm not familiar enough with xsd yet to fully understand it.

Can anyone explain why this is happening or point me to a good resource that can help?

[Edit] All of the xsd files that are to be included are in the Visual Studio project.

like image 717
starskythehutch Avatar asked May 27 '10 08:05

starskythehutch


People also ask

How do I view XSD files in Visual Studio?

You can access the XML Schema Explorer from a . vb file that has a Visual Basic XML literal associated with an . xsd file. To see the schema set in the XML Schema Explorer, right-click an XML node in an XML literal or an XML namespace import and select the Show in Schema Explorer command.

How do I import XSD files into Visual Studio?

You can easily just add an existing XSD on disk to your Visual Studio project by doing a "Add Existing Item" and then picking that file. There's no separate "import / export" functionality, really.

What can open XSD files?

An XSD file stores its contents as plain text in XML format, which means the files can be opened and viewed by any text editor and numerous other programs. However, if you want to edit an XSD file, you should use an XML editor, such as Microsoft XML Notepad, Bare Bones BBEdit, or SyncRO Soft oXygen XML Editor.

Where is XSD located?

You can find you xsd.exe in the following location (depending upon . net version installed on your pc): C:\Program Files (x86)\Microsoft SDKs\Windows\v10.


2 Answers

For me it worked after going to the properties of the XSD file and clicking on Unblock. i got this answer from How do I modify my settings to allow VS2010 to load 3rd party XSD files from the "Unauthorized Zone"?

like image 103
alsolh Avatar answered Oct 05 '22 01:10

alsolh


Visual Studio caches XSD schemas at %VsInstallDir%\xml\Schemas with Target Namespace attribute (url of schema file) when you add them to your editor.

Blog post says that
The inclusion of Local.xsd in the “Unauthorized Zone” and the warnings in the error pane about not being able to resolve the schema location are an indication to the end user that the schema they were visiting attempted to bring in a schema from a zone that it is not authorized to access.

Reason the IO Permission error shows itself is your machine has no authority to download external xsd file(s) from the location.So there is no cache that Visual Studio might validate your other xsd files.

You should check your networking options so you may download those xsd files.While you can it means you have access to that location,so Visual Studio can cache them.If you're sure that you have access,you may also download those xsd files and put them Visual Studio's default schema location and indeed add them in editor.

Also check about cache here

Hope this helps
Myra

like image 43
Myra Avatar answered Oct 05 '22 02:10

Myra