C# .NET application compile and link options

This topic describes the various options available when compiling and linking C# .NET applications.

The compile and link options available to Db2® for building C# applications on Windows with the Microsoft C# compiler, as demonstrated in the bldapp.bat batch file.

Note: With the release of Db2 12.1, versions 2.0, 3.0, and 3.5 of the .NET Framework are no longer supported by the IBM® Data Server Provider for .NET. These .NET framework versions are only available for use with 11.5 and earlier releases. The .NET Framework version 1.1 is supported only by the IBM Data Server Provider for .NET version 9.5 and earlier.

Compile and link options for stand-alone C# applications using bldapp:

Compile and link options for stand-alone C# applications:
%BLDCOMP%
Variable for the compiler. The default is csc, the Microsoft C# compiler.
/r:"%DB2PATH%"\bin\netf40\IBM.Data.DB2®.dll
Reference the Db2 dynamic link library for the .NET framework version 4.0.
%DB2PATH%
Represents root path of the Db2 product installation.
Not present on IBM Data Server Driver for ODBC and CLI or the IBM Data Server Driver Package installation.
When using the IBM Data Server Driver for ODBC and CLI or the IBM Data Server Driver Package, replace %DB2PATH% with the path to the installed driver product.

Compile and link options for the loosely-coupled sample program, LCTrans using bldapp:

%BLDCOMP%
Variable for the compiler. The default is csc, the Microsoft C# compiler.
/out:RootCOM.dll
Output the RootCOM dynamic link library, used by the LCTrans application, from the RootCOM.cs source file,
/out:SubCOM.dll
Output the SubCOM dynamic link library, used by the LCTrans application, from the SubCOM.cs source file,
/target:library %1.cs
Create the dynamic link library from the input source file (RootCOM.cs or SubCOM.cs).
/r:System.EnterpriseServices.dll
Reference the Microsoft Windows System EnterpriseServices data link library.
/r:"%DB2PATH%"\bin\netf40\IBM.Data.DB2.dll
Reference the Db2 dynamic link library for the .NET framework version 4.0.
%DB2PATH%
Represents root path of the Db2 product installation.
Not present on IBM Data Server Driver for ODBC and CLI or the IBM Data Server Driver Package installation.
When using the IBM Data Server Driver for ODBC and CLI or the IBM Data Server Driver Package, replace %DB2PATH% with the path to the installed driver product.
/r:System.Data.dll
Reference the Microsoft Windows System Data dynamic link library.
/r:System.dll
Reference the Microsoft Windows System dynamic link library.
/r:System.Xml.dll
Reference the Microsoft Windows System XML dynamic link library (for SubCOM.cs).
/r:SubCOM.dll
Reference the SubCOM dynamic link library (for RootCOM.cs and LCTrans.cs).
/r:RootCOM.dll
Reference the RootCOM dynamic link library (for LCTrans.cs).

Refer to your compiler documentation for additional compiler options.