diff --git a/src/Core/WinSWCore/ServiceDescriptor.cs b/src/Core/WinSWCore/ServiceDescriptor.cs index e62c6bf..4e3a25e 100755 --- a/src/Core/WinSWCore/ServiceDescriptor.cs +++ b/src/Core/WinSWCore/ServiceDescriptor.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Reflection; using System.Text; using System.Xml; using System.Xml.Schema; @@ -104,13 +105,23 @@ namespace winsw { XmlReaderSettings settings = new XmlReaderSettings(); + Assembly a = Assembly.GetExecutingAssembly(); + string[] resourceNames = this.GetType().Assembly.GetManifestResourceNames(); + try { - settings.Schemas.Add(null, BasePath + ".xsd"); + using (Stream schemaStream = a.GetManifestResourceStream("winsw.XMLSchema.xsd")) + { + using (XmlReader schemaReader = XmlReader.Create(schemaStream)) + { + settings.Schemas.Add(null, schemaReader); + } + + } } - catch (FileNotFoundException) + catch(Exception e) { - throw new FileNotFoundException("XSD file not found"); + throw e; } settings.ValidationType = ValidationType.Schema; diff --git a/src/Core/WinSWCore/WinSWCore.csproj b/src/Core/WinSWCore/WinSWCore.csproj index f36eb56..6bfba5a 100644 --- a/src/Core/WinSWCore/WinSWCore.csproj +++ b/src/Core/WinSWCore/WinSWCore.csproj @@ -9,6 +9,10 @@ true + + + + @@ -44,4 +48,8 @@ + + + + diff --git a/src/Core/WinSWCore/XMLSchema.xsd b/src/Core/WinSWCore/XMLSchema.xsd new file mode 100644 index 0000000..26b3f0d --- /dev/null +++ b/src/Core/WinSWCore/XMLSchema.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file