核心 2.0 和办公室互操作 - microsoft.office.core 包在哪里?
core 2.0 and office interop - where is the microsoft.office.core package?
在标准的 .NET 应用程序中,
我可以为 Office Core、Word、Excel 和 Powerpoint 添加 COM 对象。一切正常。
某些命令需要 Office 核心程序集(例如,powerpoint 使用 Office.Core.MsoTriState.msoFalse/True 命令执行某些操作,word 通过 Office.Core.MsoAutomationSecurity.[=13 使用 AutomationSecurity =]
问题出在我构建 asp 网络核心应用程序时。 Nuget 有 Excel、Word 和 Powerpoint 的包,如果我不引用任何 Office.Core 项目,它们将正常工作,但每当我引用一个项目时,我都会收到此错误:
The type 'MsoTriState' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
我尝试手动将 MSO.DLL 添加到项目中,但仍然出现相同的错误。
我也试过添加所有 COM 对象而不是 nuget 包,但是我在创建对象时遇到这样的错误:
Could not load file or assembly 'Interop.Microsoft.Office.Interop.Excel, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
如何将 Microsoft.Office.Core 包添加到我的 asp net core 2.0 应用程序中?
作为替代方案(直到有人能够提供真正的答案),我一直在使用 NetOffice nuget 包,因为它们提供了官方 Microsoft Office nuget 包中似乎缺少的核心包。
在标准的 .NET 应用程序中, 我可以为 Office Core、Word、Excel 和 Powerpoint 添加 COM 对象。一切正常。
某些命令需要 Office 核心程序集(例如,powerpoint 使用 Office.Core.MsoTriState.msoFalse/True 命令执行某些操作,word 通过 Office.Core.MsoAutomationSecurity.[=13 使用 AutomationSecurity =]
问题出在我构建 asp 网络核心应用程序时。 Nuget 有 Excel、Word 和 Powerpoint 的包,如果我不引用任何 Office.Core 项目,它们将正常工作,但每当我引用一个项目时,我都会收到此错误:
The type 'MsoTriState' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
我尝试手动将 MSO.DLL 添加到项目中,但仍然出现相同的错误。
我也试过添加所有 COM 对象而不是 nuget 包,但是我在创建对象时遇到这样的错误:
Could not load file or assembly 'Interop.Microsoft.Office.Interop.Excel, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
如何将 Microsoft.Office.Core 包添加到我的 asp net core 2.0 应用程序中?
作为替代方案(直到有人能够提供真正的答案),我一直在使用 NetOffice nuget 包,因为它们提供了官方 Microsoft Office nuget 包中似乎缺少的核心包。