0

I have referenced "Microsoft.Office.Interop.Excel" library in my application to generate excel with embed interop type set to "True". Build happens fine in Dev machine which has excel installed. My doubt is whether the same application builds fine in the Build machine which does not have excel installed.

Got to know that these COM libraries are installed in GAC assembly. Does this library come by default with .net framework or comes with installation of MS-Office excel?

I'm building my application in .net framework 4.0.

Please clarify.

user3220129
  • 503
  • 9
  • 24

2 Answers2

0

No, the office COM libraries are not installed by default in the GAC. They are not part of the .Net framework. Office, (or at least all the appropriate dlls) have to exist on the target machine.

Edit: see MS OFFICE C#: Primary Interop Assemblies

Community
  • 1
  • 1
CuriousLayman
  • 207
  • 1
  • 10
0

To Answer your qunestions

  • My doubt is whether the same application builds fine in the Build machine which does not have excel installed?

    Yes it will build fine but if you have implemented any Excel related functions it will not work in your build machine. Interop Assemblies are a way to work with office application from your managed code, So without having Office installed Interop is useless.

  • Does this library come by default with .net framework or comes with installation of MS-Office excel?

    The PIAs(Primary Interop Assembly) are installed automatically when you install Office on the development computer

Kurubaran
  • 8,696
  • 5
  • 43
  • 65
  • Thanks for clarifying. If I understand your first answer correctly, MS-Office/PIA needs to be installed in the build machine. Otherwise the build will fail. Is my understanding correct? – user3220129 Apr 03 '14 at 11:45
  • @user3220129 yes. it has to be installed. but to work with any office applications you should install office application too(ex MS Excel) . – Kurubaran Apr 03 '14 at 11:47
  • @user3220129 But i would recommend not to use Interop, because interops are bound to a specific office application version. For example if you are writing code to use excel 2010 then you will need to use `Microsoft.Office.Interop.Excel 2010`. When a user install your application in a machine which has Office 2013 your code will fail. best option is to use open source assembly such as [netOffice](http://netoffice.codeplex.com/) which can support office 2000, 2002, 2003, 2007, 2010, 2013. – Kurubaran Apr 03 '14 at 11:52