manski

Write DLL resource to file

Jun 13th, 2012
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Assembly assembly = Assembly.GetExecutingAssembly();
  2. // IMPORTANT:
  3. //   * Resource names must be qualified with the assembly's namespace
  4. //   * Resource's build action is "Embedded Resource"
  5. Stream resStream = assembly.GetManifestResourceStream("MyNamespace.myres.txt");
  6. using (Stream file = File.OpenWrite("mydest.txt")) {
  7.   resStream.CopyTo(file);
  8. }
RAW Paste Data