Install the Splunk SDK for C# v2.0

There are several options for installing the Splunk® SDK for C#:

Visual Studio

You can install the Splunk SDK for C# v2.0 in Visual Studio in several different ways:

Search available NuGet packages

To install the Splunk SDK for C# by searching available NuGet packages:

  • Open the project you want to work with Splunk Enterprise.
  • On the Tools menu, point to Library Package Manager, and then click Manage NuGet Packages for Solution.

Click Online from the list on the left, and then enter splunk into the Search Online field in the upper-right corner. The Splunk PCL Client for .NET package appears in the list, as shown here:

Manage NuGet Packages window popup

Important: Ensure that the Id of the package you choose is Splunk.Client. If the Id field in the column on the right says SplunkSDK, you have chosen the wrong package. Choose the package with the correct Id.

  1. Click the Install button for the Splunk PCL Client for .NET package.

  2. In the Select Projects window, select the checkboxes next to the projects in which you want to install the package, and then click OK.

The Package Manager adds the Splunk SDK for C# and its dependencies to your project.

Important: If you also want modular input support, repeat this process for the Splunk Modular Input SDK for .NET.
Tip: To browse the Splunk SDK for C# v2.0 APIs, right-click Splunk.Client or Splunk.ModularInputs in the Solution Explorer, and then click View in Object Browser. Click the triangle next to Splunk.Client or Splunk.ModularInputs to view its namespaces. Click the triangle next to each namespace to view its classes. For API reference documentation, see Splunk SDK for C# Reference.

Use the Package Manager Console

To install the Splunk SDK for C# by using the Package Manager Console, do the following:

  1. Open the project you want to work with Splunk Enterprise.

  2. On the Tools menu, point to Library Package Manager, and then click Package Manager Console.

  3. In the Package Manager Console at the PM> prompt, type the following to install the core SDK: 
Install-Package Splunk.Client

  4. To install the modular inputs component of the SDK, type the following: 
Install-Package Splunk.ModularInputs

The Package Manager adds the Splunk SDK for C# 2.0 and its dependencies to your project.

Tip: To browse the Splunk SDK for C# v2.0 APIs, right-click Splunk.Client or Splunk.ModularInputs in the Solution Explorer, and then click View in Object Browser. Click the triangle next to Splunk.Client or Splunk.ModularInputs to view its namespaces. Click the triangle next to each namespace to view its classes. For API reference documentation, see Splunk SDK for C# Reference.

Download a ZIP file and add it to your Visual Studio project

You can also install the Splunk SDK for C# manually—just download it, build it, and import it.

Download the SDK:

Build the SDK:

  1. In Visual Studio, on the File menu, click Open.
  2. Navigate to the location on your hard disk where you extracted the contents of the ZIP file, and open the splunk-sdk-csharp-pcl.sln solution file.
  3. On the Build menu, click Build Solution.

The solution builds. You're now ready to import the binary file(s) you want into your project.

Import the binaries:

  1. In Visual Studio, open the project you want to work with Splunk Enterprise.

  2. In the Solution Explorer, right-click References, and then click Add Reference.

    Screen shot of the Visual Studio Solution Explorer
  3. In the lower-right corner of the Reference Manager window, click the Browse button.

  4. Navigate to the location on your hard disk where you extracted the contents of the ZIP file, and find the file that corresponds to the library you want:

    • /src/Splunk.Client/bin/Debug/Splunk.Client.dll
    • /src/Splunk.ModularInputs/bin/Debug/Splunk.ModularInputs.dll
    Note: Because the modular inputs component relies on the main component, you'll find both Splunk.Client.dll and Splunk.ModularInputs.dll at the second path.
  5. Verify that the DLL files you chose have been added to the Browse section of the Reference Manager window, and that their checkboxes have been selected, and then click OK.

Splunk.Client (and, optionally, Splunk.ModularInputs) now appears in the list of references in the Solution Explorer. You've installed the Splunk SDK for C#!

Tip: To browse the Splunk SDK for C# v2.0 APIs, right-click a namespace in the Solution Explorer, and then click View in Object Browser. Click the triangle next to the namespace to view its contents. Click the triangle next to each namespace to view its classes. For API reference documentation, see Splunk SDK for C# Reference.

Download a ZIP file from our Github repo and add it to your Visual Studio project

You can install the latest version of the Splunk SDK for C# from our Github repo. Go to http://github.com/splunk/splunk-sdk-csharp-pcl and click the Download ZIP button to download the SDK as a ZIP file. Then, follow the instructions starting with "Build the SDK" in Download a ZIP file and add it to your Visual Studio project.

If you want to make a code contribution, go to the Open Source page for more information.

Xamarin

You can install the Splunk SDK for C# v2.0 in Xamarin Studio in several different ways:

Search available NuGet packages

To install the Splunk SDK for C# by searching available NuGet packages:

  1. Open the project you want to work with Splunk Enterprise.

  2. Right-click the name of your project in the Solution pane, point to Add, and then click Add Packages.

    Screen shot of the Xamarin Studio Solution pane
  3. In the Add Packages window, type splunk into the search box in the upper-right corner. Several Splunk packages appear in the list.

  4. Click the checkboxes next to the packages you want to include, and then click Add Packages:
    • The Splunk PCL Client for .NET is the main SDK.
    • The Splunk Modular Input SDK for .NET enables you to add the ability to create custom Splunk Enterprise modular inputs using C#.
    • The Splunk Logging Libraries for .NET contains libraries you can include in your C# projects that will log app activity back to Splunk Enterprise via UDP or TCP.
Note: Disregard the Splunk SDK for .NET package, as it is the old version of the Splunk SDK for C#.

The packages you chose to install are now listed in your project references under From Packages. You can also view information about what happened during installation by clicking the View menu, pointing to Pads, and then clicking Package Console.

Screen shot of the Xamarin Studio Solution pane with SDK packages installed

Download a ZIP file and add it to your Xamarin Studio project

You can also install the Splunk SDK for C# manually—just download it, build it, and import it.

Download the SDK:

Build the SDK:

  1. In Xamarin Studio, on the File menu, click Open.

  2. Navigate to the location on your hard disk where you extracted the contents of the ZIP file, and open the splunk-sdk-csharp-pcl.sln solution file.

  3. On the Build menu, click Build All.

The solution builds. You're now ready to import the binary file(s) you want into your project.

Import the binaries:

  1. In Xamarin Studio, open the project you want to work with Splunk Enterprise.


  2. In the Solution pane, right-click References, and then click Edit References.


  3. In the Edit References dialog box, click the .Net Assembly tab.

  4. Navigate to the location on your hard disk where you extracted the contents of the ZIP file, and find the file that corresponds to the library you want:

    • /src/Splunk.Client/bin/Debug/Splunk.Client.dll
    • /src/Splunk.ModularInputs/bin/Debug/Splunk.ModularInputs.dll
    Note: Because the modular inputs component relies on the main component, you'll find both Splunk.Client.dll and Splunk.ModularInputs.dll at the second path.
  5. Select the files, click Add, and then click OK.

The packages you chose to install are now listed in your project references.

Screen shot of the Xamarin Studio Solution pane with SDK components installed

Download a ZIP file from our Github repo and add it to your Xamarin Studio project

You can install the latest version of the Splunk SDK for C# from our Github repo. Go to http://github.com/splunk/splunk-sdk-csharp-pcl and click the Download ZIP button to download the SDK as a ZIP file. Then, follow the instructions starting with "Build the SDK" in Download a ZIP file and add it to your Xamarin Studio project..

If you want to make a code contribution, go to the Open Source page for more information.