简体   繁体   中英

.NET Framework 4.8 Error referencing Microsoft.Office.Core

Im trying to build an old project on a new version of the .NET Framework. When I'm trying to build that Project an Error occurs.

"The file or assembly "Interop.Microsoft.Office.Core" or a dependency of it was not found. An attempt was made to load a file with an incorrect format."

LOG: DisplayName = Interop.Microsoft.Office.Core
 (Partial.)
WRN: Partial binding information was provided for an assembly:
WRN: Assembly name: Interop.Microsoft.Office.Core | Domain ID: 2
WRN: Partial binding occurs when only part of the assembly display name is provided.
WRN: This may cause the collection folder to load an incorrect assembly.
WRN: Specify the text identity of the assembly with full details. 
WRN: This includes the simple name, version and culture, and public key token.
WRN: For more information and general solutions to this problem, see the whitepaper at "http://go.microsoft.com/fwlink/?LinkId=109270".
LOG: Appbase = file:///C:/Users/krebesli/OneDrive - TRUMPF SE + Co. KG/Project - Copy/TruTopsSales/TruTopsSales/
LOG: Original PrivatePath = C:\Users/krebesli/OneDrive - TRUMPF SE + Co. KG\Project - copy\TruTopsSales\TruTopsSales\bin
Call from Assembly : (Unknown).
===
LOG: This binding starts in default load context.
LOG: The application configuration file is used: C:\Users\krebesli\OneDrive - TRUMPF SE + Co. KG\Project - copy\TruTopsSales\TruTopsSales\web.config.
LOG: The host configuration file is used: \srvditz1\home$\krebesli\Documents\IISExpress\config\aspnet.config.
LOG: The computer configuration file of C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config is used.
LOG: policy is not currently applied to the reference (private, custom, partial, or path-based assembly binding).
LOG: download of new URL file:///C:/Users/(username)/AppData/Local/Temp/Temporary ASP.NET Files/vs/2636e7dd/88283cb5/Interop.Microsoft.Office.Core.DLL.
LOG: Download of new URL file:///C:/Users/(username)/AppData/Local/Temp/Temporary ASP.NET Files/vs/2636e7dd/88283cb5/Interop.Microsoft.Office.Core/Interop.Microsoft.Office.Core.DLL.
LOG: Download from new URL file:///C:/Users/(username)/.../.../.../bin/Interop.Microsoft.Office.Core.DLL.
ERR: Assembly setup could not be completed (hr = 0x8007000b). The search was terminated.

Error_message

I reference this dll's

dll's

I also add them via the (I believe) correct workflow via the reference managers COM Tab

COM Tab

  • The Microsoft.Office.Core reference adds via the Microsoft Office 16.0 Object Library
  • The Microsoft.Office.Interop.Excel reference adds via the Microsoft Excel 16.0 Object Library
  • The Microsoft.Office.Interop.Word reference adds via the Microsoft Word 16.0 Object Library

Has anyone a clue what I do wrong? I tried now evrything and didnt come to an solution

UPDATE:

NuGet installed packages NuGet

The Considerations for server-side Automation of Office article says the following:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

You may consider using EWS or Graph API if you deal with Exchange accounts (Office 365 for Graph API). Or just consider using third-party components designed for the server-side execution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM