I am trying to compile a project in VB.net 2010 that uses Microsoft Excel dll at some points. It works all fine when I compile from my computer, but when I use TFS to queue a new build, I get the error that Microsoft.Interop.Excel... are not defined. I installed Microsoft Office 2010 directly on the TFS server but I still get the same error.
Are there any configuration I must perform for this to work?
Edit:
Typical error message you will see on a Build:
Error BC30002: Type ‘Excel.Worksheet’ is not defined.
Error BC30002: Type ‘Microsoft.Office.Interop.Excel.Application’ is not defined.
Warning BC40056: Namespace or type specified in the Imports ‘Microsoft.Office.Interop’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn’t use any aliases.
You need to include the dll’s in a lib folder that is kept in TFS and reference the dll’s from that location, in your project not wherever else they have been installed.
Edit:
Developers typically reference the Interop PIA’s from C:\Program Files (x86)\Microsoft Visual Studio 14.0\Visual Studio Tools for Office\PIA\Office15 and this folder wont exist on the server.
You need to copy these files, eg Microsoft.Office.Interop.Excel.dll to a lib or refs folder in source control and reference these DLLs from your solution instead of the ones in the PIA path.
Also note, same goes for DLLs from the Reference Assemblies folder, eg:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Windows.Forms.dll