Export (0) Print
Expand All

Libraries Sample

This sample shows how to create and use a DLL in C#.

This sample contains the source code for the Libraries Tutorial.

Building and Running the Sample Within Visual Studio

To build and run the Libraries sample

  1. Open the solution (Libraries.sln).
  2. In Solution Explorer, right-click the FunctionTest project and click Set as StartUp Project.
  3. In Solution Explorer, right-click the FunctionTest project and click Properties.
  4. Open the Configuration Properties folder and click Debugging.
  5. In the Command Line Arguments property, enter 3 5 10.
  6. Click OK.
  7. From the Debug menu, click Start Without Debugging. This will automatically build the library in Functions and execute the program.

Building and Running the Sample from the Command Line

To build and run the Libraries sample

  1. Use the Change Directory command to change to the Functions directory.
  2. Type the following:
    csc /target:library /out:Functions.dll Factorial.cs DigitCounter.cs
    
  3. Use the Change Directory command to change to the FunctionTest directory.
  4. Type the following:
    copy ..\Functions\Functions.dll .
    csc /out:FunctionTest.exe /R:..\Functions.DLL FunctionClient.cs 
    FunctionTest 3 5 10
    

See Also

Libraries Tutorial | Tutorial Samples

Show:
© 2014 Microsoft