I have an XSLT file that I want to load and use to transform an XML file. I\'ve added the file to the same project as the code that uses it and put it in the \"Resources\" f
Change the build action from Resource to Embedded Resource, after this you can do something like
XslCompiledTransform myXslTransform = new XslCompiledTransform();
var assembly = typeof(SomeTypeFromAssemblyWithResource).Assembly;
using (var stream = assembly.GetManifestResourceStream("Resources.OrderManagement.OrderOverview.xslt"))
{
using (var xmlReader = XmlReader.Create(stream))
{
myXslTransform.Load(xmlReader );
}
}
Resource name in dll can be tricky so maybe you want first to know the resource name with Assembly.GetManifestResourceNames. Compiler generates name based on the folder and assembly.