【发布时间】:2026-01-24 21:25:01
【问题描述】:
我正在尝试使用 Microsoft Office Interops 版本 11、.NET 2.0 修复使用 Visual Studio 2003 创建的旧版应用程序。我正在尝试在 Visual Studio Express 2010 中修复它以引用 Interops 版本 14、.NET 4.0 - 正如我之前关于 * 的问题中所述,旧版应用程序在 Windows 7 中运行良好,但在我关闭它之后,Microsoft Office 产品是当我尝试使用它们时崩溃。
但是,当我修复 VS2010 中的引用(删除旧的 v.11 互操作,添加新的 v.14 互操作)然后尝试发布应用程序时,我收到类似的错误
'Microsoft.Office.Interop.Word.System does not contain a definition for IO'
当引用 Word 命名空间时,VS2010 似乎没有看到我的系统命名空间被使用?当我删除
using Microsoft.Office.Interop.Word
命名空间,然后尝试发布,上面的错误消失了,我只得到与缺少的 Word 参考相关的预期错误,如
The type or namespace name '_Document' could not be found (are you missing a using directive or an assembly reference?)
我已经在参考中包含了 System.dll,所以我不确定发生了什么?感谢阅读!
编辑:对于 Office 互操作,我将“嵌入式互操作类型”设置为 False。那可能已经修复了一些错误?但是:Visual Studio 仍在将任何系统引用解释为“Microsoft.Office.Interop.Word.System”,这不是我想要的。这个错误现在似乎是主要错误:
The type name 'Windows' does not exist in the type 'Microsoft.Office.Interop.Word.System'
【问题讨论】:
标签: c# .net ms-office .net-assembly primary-interop-assembly