Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
bhagya
Frequent Visitor

PowerBiClient object accessing exception

Hi

 

I am facing the  exception while creating the PowerBiClient Object.

 

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

 

By looking the solution in one of the forum , i have added the redirecting dependecy aw well.  but still facing this issue.

 

Task<AuthenticationResult> tokenAccessKey = Program.GetToken();
var tokenCredentials = new TokenCredentials(tokenAccessKey.Result.AccessToken, tokenAccessKey.Result.AccessTokenType);

using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))

{

}

 

Questions:  is these below making this problem

1. What should be my ApiUrl ? ex: "https://app.powerbi.com/"

2. my tokenCredentials object's Client ID and Tenent Id returning null. event though the tokenAccessKey  is valid

 

 

Power BI client issue.png

1 ACCEPTED SOLUTION

Hi,

 

I faced this issue becasue of version conflict of Newtonsoft.Json between "6.0.0.0" and "7.0.0.0"

 

"Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified."

 

Download 7.0.0.0 from nuget and add in webconfig. started working.

 

Thanks,

 

 

View solution in original post

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee


@bhagya wrote:

Hi

 

I am facing the  exception while creating the PowerBiClient Object.

 

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

 

By looking the solution in one of the forum , i have added the redirecting dependecy aw well.  but still facing this issue.

 

Task<AuthenticationResult> tokenAccessKey = Program.GetToken();
var tokenCredentials = new TokenCredentials(tokenAccessKey.Result.AccessToken, tokenAccessKey.Result.AccessTokenType);

using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))

{

}

 

Questions:  is these below making this problem

1. What should be my ApiUrl ? ex: "https://app.powerbi.com/"

2. my tokenCredentials object's Client ID and Tenent Id returning null. event though the tokenAccessKey  is valid

 

 

Power BI client issue.png


@bhagya

Yes, the ApiUrl is "https://api.powerbi.com/".

As to the null values, the probable reason is the not well installed Newtonsoft.Json. Try to uninstall and reinstall it following this thread.

Hi,

 

I faced this issue becasue of version conflict of Newtonsoft.Json between "6.0.0.0" and "7.0.0.0"

 

"Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified."

 

Download 7.0.0.0 from nuget and add in webconfig. started working.

 

Thanks,

 

 

Anonymous
Not applicable

Hi, @bhagya 

I know it has been a while, but I am getting this error when running the powershell cmdlet

Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxx' or one of its dependencies. The system cannot
find the file specified.
At line:1 char:1
+ get-PowerBIWorkspace -All

 

You mentioned that you Download 7.0.0.0 from nuget and add in webconfig.

How did you do that?

Sorry if it sounds silly, but I am a newbie

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors