Question: Im developing a WCF web service with receives always and only XML.

So i need to validate that input XML using their XSD. The question is, can i save them inside web service? Locally i can access XSD files via relative path into IIS Express root folder which i created manually. I tried add the XSD files in VS project but i just cant a find them on runtime.

I'm using the Shemas like this: [Image1 Link](http://s16.postimg.org/cmnm850lh/image.png)

IIS XSD'd Folder Path Workaround: [Image2 Link](http://i.stack.imgur.com/ePozA.png)

At the moment, its working fine, the problem will be when i try deploy the service somewhere on internet.  

Thank you.

**tl;dr: Can i send some XSD when deploying the webservice or its just impossible?**

Answer: 
You can add the XSD as a resource, then load it from your assembly. Add the XSD to your project, and under the "Properties Explorer", set the "Build Action" to "Embedded Resource". You can then read the file with:

```
var schemaSet = new XmlSchemaSet();
schemaSet.Add("", XmlReader.Create(typeof(SomeClassInTheSameAssembly).Assembly
    .GetManifestResourceStream("Full.Namespace.XsdName.xsd")));

```

See [Working with Embedded Resources](http://blah.winsmarts.com/2006-12-Working_with_Embedded_Resources.aspx) or [Loading XmlSchema files out of Assembly Resources](http://www.hanselman.com/blog/LoadingXmlSchemaFilesOutOfAssemblyResources.aspx) for more.
One way you can do it is by using an application setting in your config file that will hold a base file location such as:

```
<appSettings>
    <add key="BaseDir" value="C:\your\folder\names" />
</appSettings>

```

Then in your program, when you need a file, you would do something like this:

```
string fileLocation = System.Configuration.ConfigurationManager.AppSettings["BaseDir"] +
                           @"\your\file\location\file.xsd";

```

To use `System.Configuration.ConfigurationManager`, you will need to add a reference to `System.Configuration`.