Exporter (0) Imprimer
Développer tout
EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

/out (Set Output File Name)

/out:filename

where:

filename
The name of the output file created by the compiler.

Remarks

On the command line, it is possible to specify multiple output files for your compilation. The /out option specifies the name of the output file. The compiler expects to find one or more source code files following the /out option. Then, all source code files will be compiled into the output file specified by that /out option.

If you do not specify the name of the output file:

  • An .exe will take its name from the source code file that contains the Main method.
  • A .dll or .netmodule will take its name from the first source code file.

A source code file used to compile one output file cannot be used in the same compilation for the compilation of another output file.

When producing multiple output files in a command-line compilation, keep in mind that only one of the output files can be an assembly and that only the first output file specified (implicitly or explicitly with /out) can be the assembly.

Any modules produced as part of a compilation become files associated with any assembly also produced in the compilation. Use ildasm.exe to view the assembly manifest to see the associated files.

Specify the full name and extension of the file you want to create.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C# Project Properties.
  2. Click the Common Properties folder.
  3. Click the General property page.
  4. Modify the Assembly Name property.

To set this compiler option programmatically

See OutputFileName Property.

Example

Compile t.cs and create output file t.exe, as well as build t2.cs and create module output file mymodule.netmodule:

csc t.cs /out:mymodule.netmodule /target:module t2.cs

See Also

C# Compiler Options

Afficher:
© 2014 Microsoft