Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

/target:library (Create a Code Library) (C# Compiler Options) 

The /target:library option causes the compiler to create a dynamic-link library (DLL) rather than an executable file (EXE).


The DLL will be created with the .dll extension.

Unless otherwise specified with the /out option, the output file name takes the name of the first input file.

When specified at the command line, all files up to the next /out or /target:module option are used to create the .dll file.

When building a .dll file, a Main method is not required.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page. For details, see How to: Set Project Properties (C#, J#).

  2. Click the Application property page.

  3. Modify the Output type property.

For information on how to set this compiler option programmatically, see OutputType.

Compile in.cs, creating in.dll:

csc /target:library in.cs

Community Additions

© 2015 Microsoft