Export (0) Print
Expand All

MetaData.ConvertCodeSourceFileToAssemblyFile Method

Compiles a specified code source file into a runtime assembly file.

Namespace:  System.Runtime.Remoting.MetadataServices
Assembly:  System.Runtime.Remoting (in System.Runtime.Remoting.dll)

public static void ConvertCodeSourceFileToAssemblyFile(
	string codePath,
	string assemblyPath,
	string strongNameFilename


Type: System.String

The path to the file that contains the source code.

Type: System.String

The location where the new run-time assembly is generated.

Type: System.String

The strong name to compile into the new assembly. Can be String.Empty.

For additional information on strong names, see Strong-Named Assemblies.


If a file with the specified name already exists, it is overwritten.

The following code example demonstrates the use of the ConvertCodeSourceFileToAssemblyFile method to write the schema definition of the specified types to a runtime assembly with the specified name. The CsSource.cs file converted here contains C# source code.

using System;
using System.Runtime.Remoting.MetadataServices;

public class Test
   public static void Main()
      MetaData.ConvertCodeSourceFileToAssemblyFile("CsSource.cs", "testAssm.dll", "");

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft