Click here to Skip to main content
13,901,221 members
Rate this:
 
Please Sign up or sign in to vote.
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.[^]
   
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190306.1 | Last Updated 15 Jun 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100