I have an embedded file – xsd.exe – in my .NET library.
How can I, without rebuilding the embedded file from its byte[], use it?
The exe runs on the command line so I need to be able to make calls like: xsd /o:.. or whatever.
I have read something about ManifestResourceStream but I can’t seem to find it in the framework and I have no idea how to use it.
Any ideas?
If you can write it to a temp file (
File.WriteAllBytes), you can create a newAppDomain, and useyourAppDomain.ExecuteAssembly(...); however, to do this manually from abyte[], I expect you would need to load it manually withAssembly.Load(byte[],...), look at theloadedAssembly.EntryPoint, and use reflection to invoke it. TheExecuteAssemblyapproach is far easier…Of course, if you can write it to a file, you could also just use
Process.Startwhich is even more easy ;pYou might also want to double-check redist/deployment rights re
xsd.exe.