是否可以从 Visual Studio 2010 创建 Office 2003 VSTO 加载项?
我们现有适用于 Word 2003 和 Excel 2003 的 VS 2008 VSTO 加载项。目前我们无法升级 Office 版本。
我们刚刚尝试将解决方案升级到 VS 2010,它可以正常转换和编译,但在构建和运行加载项时,我们收到一条消息,指出未安装所需版本的 Office。
有没有办法解决这个问题(无需升级到 Office 2007 或 2010),以便我们可以使用 VS 2010 来构建此加载项?
We have existing VS 2008 VSTO add-ins for Word 2003 and Excel 2003. We are unable to upgrade the Office version at this time.
We have just tried to upgrade our solution to VS 2010 and it converts and compiles fine, but when building and running the add-in we receive a message saying that the required version of Office is not installed.
Is there any way of getting around this issue (without upgrading to Office 2007 or 2010) so that we can use VS 2010 to build this add-in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,不幸的是这是不可能的。 VSTO 2010 不会编译专为 Office 2003 设计的解决方案。它旨在与 2007/2010 配合使用。
要为 Office 2003 创建解决方案,您需要 VS2003 上的 VSTO 2005 或 VS2008 上的 VSTO 2005 SE / VSTO 2008(对于后者,您还可以为 Office 2007 进行开发)。
No, unfortunately it's not possible. VSTO 2010 will not compile solutions designed for Office 2003. It is designed to work with with 2007/2010.
To create solutions for Office 2003 you'll need VSTO 2005 on VS2003 or VSTO 2005 SE / VSTO 2008 on VS2008 (in the case of the later, you can also develop for Office 2007).
不可以。Office 版本与 VSTO 版本绑定,而 VSTO 版本又与 Visual Studio 版本绑定。由于 VSTO 2010 不支持 Office 2003,因此您无法迁移。
另外,您需要注意,打开文件扩展名可能会打开不正确的 Office 版本。例如,在启动时,更高版本的 Office 会将自身注册到注册表中。如果您正在开发 Excel 2003 VSTO 项目,但手动打开 Excel 2007 工作簿,则 2007 将成为默认值。下次处理 Excel 2003 VSTO 项目时,它将使用 Excel 2007。要返回到 Excel 2003,您必须运行
excel /regserver
。No. The Office version is tied to the VSTO version which is tied to the Visual Studio version. Since VSTO 2010 does not support Office 2003, you cannot migrate.
Also, you need to be aware that opening a file extension may open the incorrect Office version. For example, on startup the later versions of Office will register themselves into the registry. If you are developing an Excel 2003 VSTO project, but you manually open an Excel 2007 workbook, then 2007 becomes the default. The next time you work on the Excel 2003 VSTO project, it will use Excel 2007. To get back to Excel 2003, you must run
excel /regserver
.围绕答案有很多不便。
第一:即使在未安装 Office 2010 的计算机上,Visual Studio 2010 也可以安装其 VSTO 包,对我来说,这是在升级 VS2008/VSTO3 项目时完成的。
第二:升级后的项目保留了指向 Office 11、Visual Studio 9 程序集的链接。 (老实说,如果这些程序集不是单独的 VSTO3.0/4.0 运行时包的一部分,我真的怀疑 VS2012 是否会通过)。
另外,不可能从 VS2010 创建 Office 2003 项目,但是https://stackoverflow.com/a /5325505/438039 向我们指出了使 VSTO4.0(例如 Interop for Office 12、Visual Studio 10)项目在 Office 2003 中运行的广泛可能性。我认为也可以通过更改项目设置从 Studio 运行它,如下所示: C# - can' t 调试 Office Word 加载项 - 这样,我建议在不进行调试的情况下启动(因为启动时外部应用程序未附加到调试器..)。这也揭示了从我系统上的 VS2008 目录加载的
VSTOWord2003Adaptor.dll
的存在。 - 希望它是 VSTO3 / VSTO4 运行时包的一部分。另一种方法是编辑 .csproj,提供 WinWord.exe 的路径 - https://stackoverflow.com/a/12584772/438039 - 两者都无法正常工作。设置适当的 VS2010/VSTO4 开发环境比构建针对 Office 2003 的插件更困难。
There is a lot of inconvenience going around the answers.
First: Visual Studio 2010 can install its VSTO package even on machines where Office 2010 is not installed, for me it was done when upgrading VS2008/VSTO3 project.
Second: upgraded project retained links links to Office 11, Visual Studio 9 assemblies. (I honestly doubt this will pass with VS2012 though, if these assemblies aren't part of separate VSTO3.0/4.0 runtime packages).
Also, it is impossible to create Office 2003 project from VS2010, but https://stackoverflow.com/a/5325505/438039 points us to the wide possibilities of making VSTO4.0 (e.g. Interop for Office 12, Visual Studio 10) project to run within Office 2003. I think it's also possible to run it from Studio by changing project settings like in here: C# - can't debug office word add-in - this way, I recommend starting without debug (since external application isn't attached to debugger when starting..). This also revealed the existence of
VSTOWord2003Adaptor.dll
which is loaded from VS2008 directory on my system. - hope it's a part of either VSTO3 / VSTO4 runtime packages. Another way is to edit .csproj, providing path to WinWord.exe - https://stackoverflow.com/a/12584772/438039 - both aren't working right.It's harder to set up a proper VS2010/VSTO4 development environment than to build an addin targeting Office 2003.