Hi ,

I wrote following code to pull GA4 data through .Net core 3.1 App.

The App works perfectly on VS, when I publish it to the server and run, 
threw the following error:

Could not load file or assembly 'Google.Apis, Version=1.60.0.0, 
Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'. The located assembly's 
manifest definition does not match the assembly reference. (0x80131040)
System.IO.FileLoadException: Could not load file or assembly 'Google.Apis, 
Version=1.60.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'. The 
located assembly's manifest definition does not match the assembly 
reference. (0x80131040)
File name: 'Google.Apis, Version=1.60.0.0, Culture=neutral, 
PublicKeyToken=4b01fa6e34db77ab'


Here is the code:

using Google.Apis.AnalyticsReporting.v4.Data;
using Google.Apis.AnalyticsReporting.v4;

using Google.Apis.Services;
using Google.Apis.Auth.OAuth2;

var credential = GoogleCredential.FromFile("XXXX.json")
.CreateScoped(new[] { AnalyticsReportingService.Scope.AnalyticsReadonly });

using (var analytics = new AnalyticsReportingService(new 
BaseClientService.Initializer
{
HttpClientInitializer = credential
}))
{
var request = analytics.Reports.BatchGet(new GetReportsRequest
{
ReportRequests = new[] {
new ReportRequest{

DateRanges = new[] { new DateRange { StartDate = dtStartdate, EndDate = 
dtEnddate } },
Dimensions = new[] { new Dimension{ Name = "ga:date" },new Dimension{ Name 
= "ga:country" }, new Dimension{ Name = "ga:city" }
},
Metrics = new[] { new Metric{ Expression = "ga:sessions", Alias = 
"Sessions"},
new Metric{ Expression = "ga:users", Alias = "Users"},
new Metric{ Expression = "ga:newUsers", Alias = "ReturningUsers"}
},
ViewId = "XXX"
}
}
});













-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e4aefadd-fa8a-42b6-ac13-af7ff821688fn%40googlegroups.com.

Reply via email to