-
Notifications
You must be signed in to change notification settings - Fork 263
Description
Describe the bug
var scopes = new[] { "https://graph.microsoft.com/.default" };
authProvider = new GraphAuthenticationProvider(Configuration.ClientID, Configuration.TenantID, Configuration.ClientSecret.SecureStringDecrypt(), scopes);
Graphclient = new GraphServiceClient( authProvider);
public class GraphAuthenticationProvider : IAuthenticationProvider
{
private readonly IConfidentialClientApplication _clientApp;
private readonly string[] _scopes;
public GraphAuthenticationProvider(string clientId, string tenantId, string clientSecret, string[] scopes)
{
_clientApp = ConfidentialClientApplicationBuilder.Create(clientId)
.WithTenantId(tenantId)
.WithClientSecret(clientSecret)
.Build();
_scopes = scopes;
}
public async System.Threading.Tasks.Task AuthenticateRequestAsync(RequestInformation request, Dictionary<string, object> additionalAuthenticationContext = null, CancellationToken cancellationToken = default)
{
await _clientApp.AcquireTokenForClient(_scopes).ExecuteAsync();
}
I have written this code to authenticate Microsoft Graph with Version 5.60 but it is throwing error "System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies." even though we are using .Net Framework 4.7.2 and this DLL is not present there.
This is not a problem with Visual Studio 2019 and working fine there but when I am installing my application, it is throwing error.
Also everything is working fine with Microsoft Graph dotnet v3.x but with v5.x, the GraphServiceClient is going null and throwing the error mentioned above.
Expected behavior
The Microsoft Graph should authenticate without throwing any error
How to reproduce
Run the above mentioned code with Microsoft Graph version 5.60 on the .Net Framework 4.7.2
SDK Version
5.60
Latest version known to work for scenario above?
GraphServiceClient is working fine with v3.x
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
-OS: windows server 2019
-architecture: x86
### Other information
_No response_