Write the Assembly to a File

CCI Code Model

The assembly is now complete. The simplest way to use the completed assembly is to write it to a PE file and run the file. HelloCodeModel writes the Hello assembly to a file named “hello.exe”, as follows:
Stream peStream = File.Create("hello.exe");
PeWriter.WritePeToStream(assembly, host, peStream);      

The first line creates a standard .NET file stream. Microsoft.Cci.PeWriter.WritePeToStream is a static method that writes the assembly to the specified file stream. Notice that WritePeToStream depends on the host for information about application policy.

Return to Beginning

Last edited Mar 9, 2010 at 8:48 PM by Guy_Smith, version 1


No comments yet.