Castle.DynamicProxy.ModuleScope.SaveAssembly C# (CSharp) Method

SaveAssembly() public method

Saves the generated assembly with the name and directory information given when this ModuleScope instance was created (or with the DEFAULT_FILE_NAME and current directory if none was given).

This method stores the generated assembly in the directory passed as part of the module information specified when this instance was constructed (if any, else the current directory is used). If both a strong-named and a weak-named assembly have been generated, it will throw an exception; in this case, use the SaveAssembly (bool) overload.

If this ModuleScope was created without indicating that the assembly should be saved, this method does nothing.

Both a strong-named and a weak-named assembly have been generated.
public SaveAssembly ( ) : string
return string
		public string SaveAssembly()
		{
			if (!savePhysicalAssembly)
			{
				return null;
			}

			if (StrongNamedModule != null && WeakNamedModule != null)
			{
				throw new InvalidOperationException("Both a strong-named and a weak-named assembly have been generated.");
			}

			if (StrongNamedModule != null)
			{
				return SaveAssembly(true);
			}

			if (WeakNamedModule != null)
			{
				return SaveAssembly(false);
			}

			return null;
		}

Same methods

ModuleScope::SaveAssembly ( bool strongNamed ) : string

Usage Example

Beispiel #1
0
 /// <summary>
 ///   Saves the generated assembly to a physical file. Note that this renders the <see cref = "PersistentProxyBuilder" /> unusable.
 /// </summary>
 /// <returns>The path of the generated assembly file, or null if no assembly has been generated.</returns>
 /// <remarks>
 ///   This method does not support saving multiple files. If both a signed and an unsigned module have been generated, use the
 ///   respective methods of the <see cref = "ModuleScope" />.
 /// </remarks>
 public string SaveAssembly()
 {
     return(ModuleScope.SaveAssembly());
 }