У меня возникли проблемы с добавлением новых API Google Analytics в надстройку Excel, которую я создаю с помощью ExcelDna.
Я добавил эти Nugets:
<package id="Google.Apis" version="1.9.3" targetFramework="net45" />
<package id="Google.Apis.Analytics.v3" version="1.9.2.1160" targetFramework="net45" />
<package id="Google.Apis.Auth" version="1.9.3" targetFramework="net45" />
<package id="Google.Apis.Core" version="1.9.3" targetFramework="net45" />
Если я создам класс:
public class Foo {
public Foo() {
AnalyticsService bar = null;
}
}
Как только я пытаюсь создать экземпляр этого класса, я получаю исключение StackoverflowException.
Полагаю, это проблема с загрузкой сборок Google Apis?
Используя FusionLog, я вижу, что Google.Apis.Analytics.v3.dll загружается нормально, но в Google.Apis.DLL есть проблема:
*** Assembly Binder Log Entry (2015-08-27 @ 14:12:32) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Google.Apis, Version=1.9.2.27817, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab
(Fully-specified)
LOG: Appbase = file:///C:/Checkouts/NielsBosma/trunk/projects/SeoTools/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Excel-DNA: C:\Checkouts\NielsBosma\trunk\projects\SeoTools\bin\Debug\SeoTools64.xll
Calling assembly : Google.Apis.Analytics.v3, Version=1.9.2.116, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Google.Apis, Version=1.9.2.27817, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Checkouts/NielsBosma/trunk/projects/SeoTools/bin/Debug/Google.Apis.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Checkouts\NielsBosma\trunk\projects\SeoTools\bin\Debug\Google.Apis.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Google.Apis, Version=1.9.3.19379, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Я создал консольное приложение с этими пакетами, где этой проблемы нет.
Теперь я застрял. Что делать дальше?
ОБНОВИТЬ
Я обновил NetOffice и избавился от StackoverflowExeception. Теперь у меня такое исключение:
Could not load file or assembly 'Google.Apis, Version=1.9.2.27817, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)