static internal void WritePreservationFile (Assembly asm, string genericNameBase)
{
if (asm == null)
throw new ArgumentNullException ("asm");
if (String.IsNullOrEmpty (genericNameBase))
throw new ArgumentNullException ("genericNameBase");
string compiled = Path.Combine (AppDomain.CurrentDomain.SetupInformation.DynamicBase,
genericNameBase + ".compiled");
PreservationFile pf = new PreservationFile ();
try {
pf.VirtualPath = String.Concat ("/", genericNameBase, "/");
AssemblyName an = asm.GetName ();
pf.Assembly = an.Name;
pf.ResultType = BuildResultTypeCode.TopLevelAssembly;
pf.Save (compiled);
} catch (Exception ex) {
throw new HttpException (
String.Format ("Failed to write preservation file {0}", genericNameBase + ".compiled"),
ex);
}
}