Get Started Using C# with Bing Ads API
To get started developing Bing Ads API applications with a .NET language, you can start with the provided examples or follow one of the application walkthroughs for a Web or Desktop application. The examples have been developed with the Bing Ads .NET SDK and Visual Studio Community. Your custom configuration may vary.
You will need user credentials with access to Microsoft Advertising either in production or sandbox. For the production environment you will need a production developer token. All sandbox clients can use the universal sandbox developer token i.e., BBD37VB98. For more information, please see Get Started With the Bing Ads API and Sandbox.
To authenticate via OAuth, you must also register an application and get the corresponding client identifier. You also need to take note of the client secret and redirect URI if you are developing a web application. For more details about registering an application in production and the authorization code grant flow, see Authentication with OAuth and Authentication With the SDKs. Although in production you must use your own application ID (a.k.a. client ID), all Microsoft Advertising customers can use the public "Tutorial Sample App" client ID in sandbox i.e., 4c0b021c-00c3-4508-838f-d3127e8167ff. For more information, please see Sandbox.
Install the SDK
Install the Bing Ads .NET SDK through NuGet, either through the Manage NuGet Packages user interface, or through the Package Manager Console. For information about installing NuGet, see https://docs.nuget.org.
The Bing Ads .NET SDK supports .NET Standard 2.0. You can choose from a variety of platforms e.g., .NET Core or .NET Framework 4.6.1. The Bing Ads API examples are developed via Visual Studio Community 2017 and target .NET Framework 4.7.1. The .NET Standard 2.0 and Bing Ads .NET SDK do not support .NET Framework versions lower than 4.6.1. For more information on .NET Standard and how it relates to other .NET frameworks, refer to this article on .NET Standard.
NuGet Package Manager Console
- Click on Tools -> NuGet Package Manager -> Package Manager Console.
- Choose the default project where you want the SDK installed, and then within the console command line, type
- If you do not already have references to System.ServiceModel.Primitives 4.4.1, System.ServiceModel.Http 4.4.1, and System.ServiceModel.ConfigurationManager 4.4.1, type
Install-Package System.ServiceModel.Primitives -Version 4.4.1,
Install-Package System.ServiceModel.Http -Version 4.4.1, and
Install-Package System.Configuration.ConfigurationManager -Version 4.4.1.