Compiler.Compile(String[], String[], String, String[], IDictionary) Método
Definição
Compila as fontes C# determinadas para o arquivo de destino especificado.Compiles the given C# sources to the specified destination file.
public:
static cli::array <Microsoft::CSharp::CompilerError ^> ^ Compile(cli::array <System::String ^> ^ sourceTexts, cli::array <System::String ^> ^ sourceTextNames, System::String ^ target, cli::array <System::String ^> ^ imports, System::Collections::IDictionary ^ options);
public static Microsoft.CSharp.CompilerError[] Compile (string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options);
static member Compile : string[] * string[] * string * string[] * System.Collections.IDictionary -> Microsoft.CSharp.CompilerError[]
Public Shared Function Compile (sourceTexts As String(), sourceTextNames As String(), target As String, imports As String(), options As IDictionary) As CompilerError()
Parâmetros
- sourceTexts
- String[]
Uma matriz do tipo de cadeia de caracteres, cada uma com código C#.An array of type string, each with C# code.
- sourceTextNames
- String[]
Uma matriz do tipo de cadeia de caracteres que contém os nomes de arquivo para cada sourceTexts.An array of type string that contains the file names for each sourceTexts.
- target
- String
O nome do arquivo de saída.The output file name. Esse argumento é necessário.This argument is required.
- imports
- String[]
Uma matriz de cadeia de caracteres de tipo, com arquivos a referenciar.An array of type string, with files to reference.
- options
- IDictionary
Um IDictionary de opções do compilador.An IDictionary of compiler options.
Retornos
Retorna mensagens de diagnóstico como uma matriz do tipo CompilerError.Returns diagnostic messages as an array of type CompilerError. Se a matriz está vazia ou todos os elementos são avisos, a compilação foi bem-sucedida.If the array is empty or all elements are warnings, the compilation succeeded.
Exceções
sourceTexts é null.sourceTexts is null.
- ou --or-
sourceTextNames é null.sourceTextNames is null.
- ou --or-
target é null.target is null.
sourceTexts é uma matriz vazia.sourceTexts is an empty array.
- ou --or-
sourceTextNames não é do mesmo tamanho que sourceTexts.sourceTextNames is not the same size as sourceTexts.
Comentários
Cada cadeia de caracteres no parâmetro sourceTexts é equivalente a um único arquivo de origem.Each string in the sourceTexts parameter is the equivalent of a single source file. Deve haver pelo menos um elemento sourceTexts.There must be at least one sourceTexts element.
Os nomes de arquivo no parâmetro sourceTextNames são usados para diagnóstico de compilador e informações de depuração.The file names in the sourceTextNames parameter are used for compiler diagnostics and debug information. A matriz é necessária, mas pode ser substituída localmente pelo uso da # diretiva line.The array is required, but it can be locally overridden by use of the #line directive. A matriz deve ter o mesmo número de elementos que o parâmetro sourceTexts.The array must have the same number of elements as the sourceTexts parameter.
O parâmetro Imports é o mesmo que a opção de compilador/Reference.The imports parameter is the same as the /reference compiler option. Esse parâmetro pode ser .This parameter can be .
Para o parâmetro options, a chave é a forma abreviada da opção do compilador.For the options parameter, the key is the short form of the compiler option. O valor é o valor desejado para a opção.The value is the value desired for the option. O parâmetro options pode ser .The options parameter can be . Algumas opções do compilador não são reconhecidas.Some compiler options are not recognized. Opções e valor reconhecidos:Recognized options and value:
| Nome da ChaveKey Name | UsoUsage |
|---|---|
| addmoduleaddmodule | Lista de módulos a serem incluídos neste assembly.List of modules to include in this assembly. Os nomes de módulo devem ser separados pela barra vertical ou pelo caractere de pipe.The module names must be separated by the vertical bar or pipe character. O valor deve ser do tipo String .Value must be of type String. Consulte -addmodule (opções do compilador C#).See -addmodule (C# Compiler Options). |
| BaseAddressbaseaddress | Endereço base para bibliotecas.Base address for libraries. O valor deve ser do tipo UInt32 .Value must be of type UInt32. Consulte -BaseAddress (opções do compilador C#).See -baseaddress (C# Compiler Options). |
| bugreportbugreport | Produz o arquivo de relatório de bugs.Produces bug report file. O valor deve ser do tipo String .Value must be of type String. Consulte -bugreport (opções do compilador C#).See -bugreport (C# Compiler Options). |
| checkedchecked | Defina avaliação de expressão padrão como marcada (ou desmarcada).Set default expression evaluation to checked (or unchecked). O valor deve ser do tipo Boolean .Value must be of type Boolean. Consulte -Checked (opções do compilador C#).See -checked (C# Compiler Options). |
| dd | Lista de símbolos separados por ponto e vírgula para definir.List of semicolon separated symbols to define. O valor deve ser do tipo String .Value must be of type String. Consulte -definir (opções do compilador C#).See -define (C# Compiler Options). |
| depurardebug | Emitir informações de depuração com a saída.Emit debug information with output. O valor deve ser do tipo Boolean .Value must be of type Boolean. Full ou PDB-only não pode ser especificado.Full or pdb-only cannot be specified. Consulte -debug (opções do compilador C#).See -debug (C# Compiler Options). |
| docdoc | Nome do arquivo no qual colocar comentários XML.File name to put XML comments in. O valor deve ser do tipo String .Value must be of type String. Consulte -Doc (opções do compilador C#).See -doc (C# Compiler Options). |
| alinhar afilealign | Tamanho do alinhamento da seção PE.PE section alignment size. O valor deve ser do tipo UInt32 .Value must be of type UInt32. Consulte -filealign (opções do compilador C#).See -filealign (C# Compiler Options). |
| INCRincr | Habilite a recompilação incremental.Enable incremental rebuild. O valor deve ser do tipo Boolean .Value must be of type Boolean. |
| liblib | Caminhos adicionais para pesquisar ao localizar módulos e assemblies referenciados.Additional paths to search when locating modules and referenced assemblies. O valor deve ser do tipo String .Value must be of type String. Consulte -lib (opções do compilador C#).See -lib (C# Compiler Options). |
| linkreslinkres | Vincular um recurso gerenciado ao assembly.Link a managed resource to the assembly. O valor deve ser do tipo String .Value must be of type String. Consulte -linkresource (opções do compilador C#).See -linkresource (C# Compiler Options). |
| mm | Digite para pesquisar no método Main.Type to search in for the Main method. O valor deve ser do tipo String .Value must be of type String. Consulte -Main (opções do compilador C#).See -main (C# Compiler Options). |
| nostdlibnostdlib | Não faça referência automática mscorlib.dll.Do not auto-reference mscorlib.dll. O valor deve ser do tipo Boolean .Value must be of type Boolean. Consulte -nostdlib (opções do compilador C#).See -nostdlib (C# Compiler Options). |
| nowarnnowarn | Lista de números de aviso separados por ponto e vírgula para não relatar.List of semicolon separated warning numbers to not report. O valor deve ser do tipo String .Value must be of type String. Consulte -nowarn (opções do compilador C#).See -nowarn (C# Compiler Options). |
| oo | Habilitar otimizações do compilador.Enable compiler optimizations. O valor deve ser do tipo Boolean .Value must be of type Boolean. Consulte -Optimize (opções do compilador C#).See -optimize (C# Compiler Options). |
| rr | Assemblies referenciados.Referenced assemblies. O valor deve ser do tipo cadeia de caracteres.Value must be of type String. Se mais de um assembly for especificado, o nome do arquivo deverá ser separado pela barra vertical ou pelo caractere de pipe.If more than one assembly is specified, the file name must be separated by the vertical bar or pipe character. Consulte -Reference (opções do compilador C#).See -reference (C# Compiler Options). |
| resres | Inserir um recurso gerenciado.Embed a managed resource. O valor deve ser do tipo String .Value must be of type String. Consulte -recurso (opções do compilador C#).See -resource (C# Compiler Options). |
| destinotarget | Tipo de destino do arquivo de saída, um dos seguintes: "biblioteca", "exe", "winexe" ou "módulo".Output file target type, one of the following: "library", "exe", "winexe", or "module". O valor deve ser do tipo String .Value must be of type String. Consulte -Target (opções do compilador C#).See -target (C# Compiler Options). |
| unsafeunsafe | Permitir constructos não seguros.Allow unsafe constructs. O valor deve ser do tipo Boolean .Value must be of type Boolean. Consulte – não seguro (opções do compilador C#).See -unsafe (C# Compiler Options). |
| ww | Nível de aviso (0-4).Warning level (0-4). O valor deve ser do tipo String .Value must be of type String. Consulte -WARN (opções do compilador C#).See -warn (C# Compiler Options). |
| warnaserrorwarnaserror | Relatar diagnóstico de aviso como erros.Report warning diagnostics as errors. O valor deve ser do tipo Boolean .Value must be of type Boolean. Consulte -warnaserror (opções do compilador C#).See -warnaserror (C# Compiler Options). |
| win32iconwin32icon | Ícone do Win32 para recurso do Win32 gerado automaticamente.Win32 icon for auto generated Win32 resource. O valor deve ser do tipo String .Value must be of type String. Consulte -win32icon (opções do compilador C#).See -win32icon (C# Compiler Options). |
| win32reswin32res | Arquivo de recurso do Win32.Win32 resource file. O valor deve ser do tipo String .Value must be of type String. Consulte -win32res (opções do compilador C#).See -win32res (C# Compiler Options). |