System.Reflection.Emit.AssemblyBuilder.Save Method

Saves this dynamic assembly to disk.

Syntax

public void Save (string assemblyFileName)

Parameters

assemblyFileName
The file name of the assembly.

Remarks

This method saves all non-transient dynamic modules defined in this dynamic assembly. Transient dynamic modules are not saved. The assembly file name can be the same as the name of one of the modules. If so, the assembly manifest is stored within that module. assemblyFileName can be different from the names of all of the modules contained within the assembly. If so, the assembly file contains only the assembly manifest.

For each System.Resources.ResourceWriter obtained using AssemblyBuilder.DefineResource(string, string, string), this method writes the .resources file and calls System.Resources.ResourceWriter.Close to close the stream.

The assemblyFileName needs to be a simple file name without a drive or directory component. To create an assembly in a specific directory, use one of the AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, AssemblyBuilderAccess) methods that takes a target directory argument.

In the .NET Framework version 2.0, this overload of the erload:System.Reflection.Emit.AssemblyBuilder.Save method is equivalent to calling the AssemblyBuilder.Save(string, System.Reflection.PortableExecutableKinds, System.Reflection.ImageFileMachine) method overload with System.Reflection.PortableExecutableKinds.ILOnly for the portableExecutableKind parameter and System.Reflection.ImageFileMachine.I386 for the imageFileMachine parameter.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0