XML Schema Definition Tool not generating SchemaLocation

Does the xsd.exe tool provided with Visual Studio generate the SchemaLocation attribute (in the xs:import) when generating XSDs from plain old C# objects?

I am finding that my XSDs that were generated are not valid because the xs:import will import a namespace and not provide the relative schemalocation value prompting the below

Imported Schema for namespace 'urn:company-event-namespace' was not resolved.


As you've found, it does not generate that attribute. This may have to do with the fact that it would not use that attribute if the attribute were present in a schema it was reading.


As shown in this anwser you can add manually add an attribute. Because the xsd tool generates a partial class, you can add this attribute in a seperate file, so you don't have to modify a generated file.

public partial class Gpx { [XmlAttribute("schemaLocation", Namespace = XmlSchema.InstanceNamespace)] public string xsiSchemaLocation = "http://www.topografix.com/GPX/1/1 " + "http://www.topografix.com/GPX/1/1/gpx.xsd"; }


  • After switching from Spring Boot 1.2.8 to 1.3.2 application magically stops working
  • Grails redirect with reverse proxy
  • SessionInformation expiration doesn't lead to user log out from system
  • Reading contents of a managed bean with reflection in a JSF application
  • Write “NOT IN” in Doctrine Query Language
  • Encrypting credit card details using AngularJS in Braintree
  • Autohotkey script running program with command line arguments
  • C++ Coin flip program error
  • string.IsNullOrEmpty() Doesn't Seem to Work on a String within a Class within a Class
  • WPF Template Binding in ToggleButton UserControl
  • UWP/C# - Issue with AQS and USB Devices
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • Subclassing QGraphicsItem prevents me from being able to use itemAt() on a QGraphicsScene/View
  • Simulate click Geckofx vb,net
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • presentShareDialogWithParams posts to FB wall, but callback handler results say error
  • Zurb Foundation _global.scss meta styles for js?
  • Unable to decode certificate at client new X509Certificate2()
  • Jetty 9 HashLoginService
  • AJAX Html Editor Extender upload image appearing blank
  • d3 v4 drag and drop with TypeScript
  • one Local Olampyad Questions on Informatic in 2011
  • JQuery Internet Explorer and ajaxstop
  • Handling un-mapped Rest path
  • Paperclip, set path outside of rails root folder
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • How to set/get protobuf's extension field in Go?
  • script to move all files from one location to another location
  • Cassandra Data Model
  • Join two tables and save into third-sql
  • Trying to switch camera back to front but getting exception
  • Importing jscolor library in angular 2
  • How to make Safari send if-modified-since header?
  • Release, debug version and Authorization Google?
  • Is there a mandatory requirement to switch app.yaml?
  • Memory offsets in inline assembly
  • Linking SubReports Without LinkChild/LinkMaster
  • Checking variable from a different class in C#