将Office升级到Office 2007会影响VS 2008的构建 [英] Upgrade office to Office 2007 affects VS 2008 build

查看:84
本文介绍了将Office升级到Office 2007会影响VS 2008的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Office从2003年更新为Office2007.我还更新了一个可与excel工作表一起使用的C#项目,发现它在Office 2003中不再起作用.在错误消息中,我收到以下消息发生了未处理的异常在您的应用程序中....无法加载文件或程序集Microsoft.Office.Interop.Excel ...或其依赖项之一."
有什么方法可以使它同时适用于Office 2003和2007?
在此先感谢.

I recently updated office from 2003 to office 2007. I also updated a C# project that works with excel sheets and discovered that it no longer works in office 2003. In the error message, I got the following message "Unhandled exception has occurred in your application....Could not load file or assembly Microsoft.Office.Interop.Excel...or one of its dependencies"
Is there any way to make it work for both office 2003 and 2007?
Thanks in advance.

推荐答案

您好,
不确定是否可以正常工作,但是如果您为Office 2007安装了PIA,然后再次调试该应用程序,则可能是您的问题将得到解决,因为Excel 2007 PIA与Office 2003的PIA向后兼容. :

下载MS Office 2007的PIA:
http://www.microsoft.com/downloads/zh-CN/details.aspx?familyid = 59DAEBAA-BED4-4282-A28C-B864D8BFA513& displaylang = zh_CN [ http://msdn.microsoft.com/en-us/library/aa302338.aspx [ ^ ]

http://stackoverflow. com/questions/2239472/trying-to-do-office-automation-with-excel-2007-but-keeps-using-excel-2003 [
hello there
Not sure is that gonna work or notbut if you install the PIA for the Office 2007 and again debug the application then may be your problem will be resolved because the Excel 2007 PIA is backward compatible with PIA for office 2003. Important links for this are below :

download for the PIA for MS Office 2007 :
http://www.microsoft.com/downloads/en/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en[^]

what is Primary Interop Assemblies (PIAs):
http://msdn.microsoft.com/en-us/library/aa302338.aspx[^]

http://stackoverflow.com/questions/2239472/trying-to-do-office-automation-with-excel-2007-but-keeps-using-excel-2003[^]

may help you with the problem
best regards


最终对我有用的解决方案是从项目中删除对Microsoft Office的所有引用,然后重新添加Microsoft.Office.Interop.Excel.但是要选择以前的版本(11而不是12),然后再次进行编译.在Bin目录中,创建了Microsoft.Office.Interop.Excel.dll. dll必须位于* .exe文件附近.
The solution that eventually worked for me was to delete all references to Microsoft office from the project and then add Microsoft.Office.Interop.Excel anew. But to select the previous version (11 and not 12 )and then to compile again. In the Bin directory a Microsoft.Office.Interop.Excel.dll was created. It is essential that the dll will reside near the *.exe file.


这篇关于将Office升级到Office 2007会影响VS 2008的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆