Bewerken

Delen via


MetaData.ConvertCodeSourceFileToAssemblyFile(String, String, String) Method

Definition

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

public:
 static void ConvertCodeSourceFileToAssemblyFile(System::String ^ codePath, System::String ^ assemblyPath, System::String ^ strongNameFilename);
public static void ConvertCodeSourceFileToAssemblyFile (string codePath, string assemblyPath, string strongNameFilename);
static member ConvertCodeSourceFileToAssemblyFile : string * string * string -> unit
Public Shared Sub ConvertCodeSourceFileToAssemblyFile (codePath As String, assemblyPath As String, strongNameFilename As String)

Parameters

codePath
String

The path to the file that contains the source code.

assemblyPath
String

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

strongNameFilename
String

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

Examples

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.dll>
#using <system.runtime.remoting.dll>

using namespace System;
using namespace System::Runtime::Remoting::MetadataServices;
int main()
{
   MetaData::ConvertCodeSourceFileToAssemblyFile( "CsSource.cs", "testAssm.dll", "" );
   return 0;
}
using System;
using System.Runtime.Remoting.MetadataServices;

public class Test
{
   public static void Main()
   {
      MetaData.ConvertCodeSourceFileToAssemblyFile("CsSource.cs", "testAssm.dll", "");
   }
}
Imports System.Runtime.Remoting.MetadataServices


Public Class Test
   
   Public Shared Sub Main()
      MetaData.ConvertCodeSourceFileToAssemblyFile("CsSource.cs", "testAssm.dll", "")
   End Sub
End Class

Remarks

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

Note

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

Applies to