Exception when creating Word 2019 application with administrator authority
Hello,
I am providing translated content. Please forgive any grammatical errors.
I have a program developed using C# and referencing the Microsoft.Office.Interop.Word assembly.
- Assembly Version: 15.0.0.0
- Development Environment: Windows 10 (64-bit), Visual Studio 2019
- Office Version: 2019
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
The above code worked normally on a PC with Word 2013 installed, but an exception occurs on a PC with Word 2019 installed.
Exception message:
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
If the requestedExecutionLevel level value is "requireAdministrator" in the app.manifest file of the C# project, the error is generated.
(If you switch to asInvoker, there will be no errors.)
app.manifest
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
When I checked with the task manager, the Word process came up in the background process and disappeared.
The developed program must be executed with administrative authority and must be configured as a requireAdministrator.
Can't I run Word 2019 if I set it like this?
Why do I get errors in Word 2019 instead of in Word 2013?
I would like to know the cause and solution of the error in Word 2019.
Please answer about my question.
Thank you.
(+) Addition
It's not a problem when debugging the project, but when I run it as an executable, a problem occurs.