Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I need to work with Excel in my application. so, I am trying to install Microsoft.Office.Interop.Excel with nugget package but it is giving below error :

Install-Package : An error occurred while retrieving package metadata for 'HtmlAgilityPack.1.8.4' from source 'E:\Sample\packages'.

Attempting to gather dependencies information for package 'Microsoft.Office.Interop.Excel.15.0.4795.1000' with respect to project 'Sample', targeting '.NETFramework,Version=v4.5.2'

Install-Package : An error occurred while retrieving package metadata for 'HtmlAgilityPack.1.8.4' from source 'E:\Sample\packages'.

At line:1 char:16 + Install-Package <<<< C:\Users\admin\Downloads\Microsoft.Office.Interop.Excel.15.0.4795.1000.nupkg + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


I am trying with below command in package manager console.

PM> Install-Package Microsoft.Office.Interop.Excel -Version 15.0.4795.1000

can any one have any clue what is happening?

Thanks,

What I have tried:

I tried with diff versions but no luck.
Posted
Updated 15-Jun-18 4:39am
v15

1 solution

The package Microsoft.Office.Interop.Excel.15.0.4795.1000 is not listed on the official NuGet site. And I can't see any reason why it would have a dependency on the HTML Agility Pack.

However, you've tagged your question as ASP.NET. Office Interop cannot be used in ASP.NET applications:
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.

There are various ways to read and create Excel spreadsheets on the server without using Office interop. For example:


NB: If you need to support older Excel documents (.xls rather than .xlsx), then you'll need to use NPOI:
GitHub - tonyqus/npoi: a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900