dotnet / dotnet/project-system

Incorrect COMReference entry when using Office interop

Open
#5,735 21 comments 3 reactions 1 assignee Claimed by @tmeschter View on GitHub
Bug Bash Needs-CPS-work Parity-Legacy-Feature Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

To include Excel interop libraries _in .NET Core app_, I do the following: `Dependencies -> Add Reference -> COM -> Microsoft Excel 14.0 Object Library`. When I do this, I get the following `ItemGroup`:

```xml


00020813-0000-0000-c000-000000000046
1
7
tlbimp
0
false

```
However, I get the following runtime error:
> Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.

In order to work, I have created .NET Framework app, added COM reference there and copied its COMReference - and **it works**:

```xml


{00020813-0000-0000-C000-000000000046}
1
7
0
primary
False
True

```
As noted [here](https://github.com/dotnet/runtime/issues/796), in order to fix the situation, the project system needs to add `True`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.