I have a Excel Document level customization project that was build using VSTO 2005 that uses Excel 2003 template (xlt). Now I have migrated to VS2010 (.NET4) and Excel 2007 environment.
My application is a reporting tool that users can create Excel reports using the customization. So currently they have number of existing *.xls and *.xlsx reports.
My problem is after I have migrated my solution to VSTO2010, I cannot open previously created reports. It givesthe error,
Could not load file or assembly 'MyApp.BusinessAnalytics, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. This
assembly is built by a runtime newer than the currently loaded runtime and cannot be
loaded.
I am using MSI in order to install the application.
When I compared the application reports that created using VS2005 version and VS2010 version I have noticed the '_AssemblyName', '_AssemblyLocation' and 'Solution ID' is different in 2 versions. For an example, 2005/Excel 2003 version has * for _AssemblyName but 2010 has '4E3C66D5-58D4-491E-A7D4-64AF99AF6E8B'.
I have enabled the assembly binding log. and observed the assembly binding exception using fuslogvw.exe
The entry in Assembly binding log:
*** Assembly Binder Log Entry (8/3/2011 @ 11:57:28 AM) ***
The operation failed.
Bind result: hr = 0x8013101b. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = CORPNET\vohelk
LOG: DisplayName = Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.dll.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework \v2.0.50727\config\machine.config.
LOG: Post-policy reference: Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/Ifs.Application.BusinessAnalytics.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.dll
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x8013101b).
ERR: Setup failed with hr = 0x8013101b.
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.
Do you have any clue on this. Greatly appreciate your help regarding this.
Notice that in your fushion log the assembly manager is still from v2.0 (This is where the message comes from since it is trying to load a v4 assembly inside the v2 runtime)
Upgrading requires a bit more work than simply opening it in vs2010 especially if you move to framework V4. A quick workaround for you could also be to target framework 3.5 instead of 4
How and what you need to change depends on where you are coming from and what you are using. Have a look at these two msdn documents on upgrading and review those steps carefully for your scenerio. It's a bit of a read but I experienced it as pretty complete and useful.
Upgrading and Migrating Office Solutions and Migrating Office Solutions to the .NET Framework 4
User contributions licensed under CC BY-SA 3.0