迁移到 VSTO2010 后无法打开 VSTO 2005/Excel 2003 自定义文件
我有一个 Excel 文档级自定义项目,该项目是使用 VSTO 2005 构建的,该项目使用 Excel 2003 模板 (xlt)。现在我已经迁移到VS2010(.NET4)和Excel 2007环境。
我的应用程序是一个报告工具,用户可以使用自定义创建 Excel 报告。因此,目前他们拥有大量现有的 *.xls 和 *.xlsx 报告。
我的问题是在我将解决方案迁移到 VSTO2010 后,我无法打开以前创建的报告。它给出了错误,
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.
我正在使用 MSI 来安装应用程序。
当我比较使用 VS2005 版本和 VS2010 版本创建的应用程序报告时,我注意到两个版本中的“_AssemblyName”、“_AssemblyLocation”和“解决方案 ID”不同。例如,2005/Excel 2003 版本的 _AssemblyName 为 *,但 2010 版本的 _AssemblyName 为“4E3C66D5-58D4-491E-A7D4-64AF99AF6E8B”。
我已启用程序集绑定日志。并使用fuslogvw.exe观察程序集绑定异常程序
集绑定日志中的条目:
*** 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.
您对此有任何线索吗?非常感谢您对此提供的帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,在您的 fushion 日志中,程序集管理器仍然来自 v2.0(这是消息的来源,因为它试图在 v2 运行时加载 v4 程序集)
升级需要比简单地在 vs2010 中打开它更多的工作,尤其是如果您迁移到框架 V4。对您来说,一个快速的解决方法也可以是针对框架 3.5 而不是 4
您需要更改的方式和内容取决于您来自哪里以及您正在使用什么。查看这两个有关升级的 msdn 文档,并根据您的场景仔细检查这些步骤。读起来有点长,但我觉得它非常完整且有用。
升级和迁移 Office 解决方案
和
将 Office 解决方案迁移到 .NET Framework 4
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