Prerequisites
Before installing the SDK, ensure you have:- .NET SDK installed (version 5.0 or later recommended)
- Visual Studio 2019/2022, Visual Studio Code, or JetBrains Rider
- NuGet package manager (included with Visual Studio and .NET CLI)
The SDK targets .NET Standard 2.0, .NET Standard 2.1, and .NET 5.0+, making it compatible with a wide range of .NET applications.
Installation via NuGet
There are several ways to install the Microsoft Graph .NET SDK package.Option 1: Package Manager Console
If you’re using Visual Studio, open the Package Manager Console and run:Option 2: .NET CLI
From your project directory, run:Option 3: Visual Studio NuGet Manager
Open NuGet Package Manager
Right-click on your project in Solution Explorer and select “Manage NuGet Packages”
Option 4: Project File
Add the package reference directly to your.csproj file:
Installing Authentication Dependencies
The SDK requires authentication credentials. Install Azure.Identity for TokenCredential support:Using .NET CLI
Using Package Manager Console
Azure.Identity provides production-ready authentication implementations including interactive browser, device code, client secret, and certificate-based authentication.
Target Framework Requirements
The Microsoft Graph .NET SDK supports multiple target frameworks:| Target Framework | Minimum Version | Recommended For |
|---|---|---|
| .NET Standard 2.0 | 2.0.0 | .NET Framework 4.6.1+, Broad compatibility |
| .NET Standard 2.1 | 2.1.0 | .NET Core 3.0+, Better performance |
| .NET 5+ | 5.0 | Modern .NET applications, Latest features |
Verify Your Project Configuration
Check your.csproj file to ensure compatibility:
Package Dependencies
When you install Microsoft.Graph, the following dependencies are automatically installed:Microsoft.Graph.Core
Version: 3.xPurpose: Core abstractions, HTTP middleware, and request infrastructure The Core package provides:
- HTTP handler middleware for retry, redirect, and authentication
- Request/response abstractions
- Serialization infrastructure
- Batch request support
Kiota Packages
The v5 SDK uses Kiota for code generation and includes:- Microsoft.Kiota.Abstractions - Core abstractions for request building
- Microsoft.Kiota.Http.HttpClientLibrary - HTTP client implementation
- Microsoft.Kiota.Serialization.Json - JSON serialization
- Microsoft.Kiota.Authentication.Azure - Azure authentication integration
All Kiota dependencies are automatically managed - you don’t need to install them separately.
Verifying Installation
After installation, verify the SDK is working correctly.Create a Test File
Create a new fileGraphTest.cs:
Build Your Project
Common Installation Issues
Issue: Package Restore Fails
Error message:- Ensure you have internet connectivity
- Clear NuGet cache:
dotnet nuget locals all --clear - Restore packages:
dotnet restore
Issue: Version Conflicts
Error message:Issue: .NET Framework Compatibility
Error message:.csproj:
Issue: Long Path Names (Windows)
Error message:- Run in command prompt as Administrator:
- Set registry key:
Development Environment Setup
Visual Studio Configuration
For the best development experience in Visual Studio:Enable NuGet Package Restore
Tools → Options → NuGet Package Manager → General
Check “Allow NuGet to download missing packages”
Check “Allow NuGet to download missing packages”
Enable IntelliSense
The SDK includes XML documentation for full IntelliSense support
Ensure “Tools → Options → Text Editor → C# → IntelliSense” is enabled
Ensure “Tools → Options → Text Editor → C# → IntelliSense” is enabled
Visual Studio Code Configuration
For VS Code users, install these extensions:- C# Dev Kit - Full C# language support
- NuGet Package Manager - GUI for managing packages
- .NET Core Test Explorer - For running tests
JetBrains Rider Configuration
Rider includes built-in NuGet support. After installation:- Enable automatic package restore: Settings → Build, Execution, Deployment → NuGet
- The SDK’s XML documentation will automatically provide IntelliSense
Additional Packages
Depending on your scenarios, you may want to install additional packages:Microsoft.Graph.Beta
For beta endpoint access:Microsoft.Identity.Client (MSAL)
For advanced authentication scenarios:Azure.Identity is built on top of MSAL and is recommended for most scenarios. Only use MSAL directly if you need advanced authentication customization.
Next Steps
Now that you have the SDK installed, you’re ready to build your first Microsoft Graph application!Quick Start Guide
Build your first Graph API call in 5 minutes
Authentication Setup
Configure authentication for your application
Core Concepts
Learn about request builders and models
API Reference
Explore the complete API reference
Package Information
- Package Name: Microsoft.Graph
- Current Version: 5.103.0
- License: MIT License
- Repository: GitHub - microsoftgraph/msgraph-sdk-dotnet
- NuGet: nuget.org/packages/Microsoft.Graph
- Release Cadence: Updated during the second and fourth week of each month
View the complete changelog for detailed release notes and version history.
