


You will find three distinct methods suggested to work around these problems: Surprisingly, even if you explicitly link to a particular Type Library, VS.NET will override your reference and use the registered version. In the case of PIAs, VS.NET will find a copy with a strong name, in the GAC, and hence will not even make an Interop assembly. Hence, Visual Studio will always only find one version to which it can link. When a subsequent version is installed on the machine, previous versions are overwritten.

Generally, you can only install a single version of Office on a particular PC various CLASSIDs that represent objects in the application are thus "installed", or "registered" to trigger this version. The above code produces this error when compiled on an Excel 2003 machine and run on Excel 2000 VB code assigns a 2-dim String array to the Value property of an Excel.Range object Sub FillRange(ByRef rng As Excel.Range, ByVal iLength As Integer, ByVal iWidth As Integer) NET deployment where backward compatibility is concerned. The PIA (Primary Interop Assembly) concept further complicates. In a Production environment that spans multiple versions of office, however, you may still run into errors, because the structure of type libraries and how they are linked in the registry has changed. Microsoft has kept Office backward compatible for a few generations so you can expect most previous functionality to be available still in Office 2003 (aka 11.0). If the project is then deployed to a machine with a different version of Excel, you can expect to run into problems. Depending on which version of MS Excel is loaded on the machine on which your project is compiled, you will get a different Interop created. The Add Reference dialog shows Excel 11.0 Object Library when Excel 2003 installedĪs an example, we will look at Microsoft Excel.

When type libraries exist with multiple versions, this can complicate your life significantly. NET Interop assembly that allows you to use the COM interface at design-time, and then handles the calls to COM at run-time. When you add this reference to your project, the type library is wrapped with a. Every COM interface available on the machine is described by a Type Library (commonly held in a TLB file, and referenced by a CLASSID in the Registry). NET Assemblies and COM components to find the code library you wish to automate. You can then browse through the available. You simply right click "References" in the Project Explorer, and Add New Reference. NET makes linking to COM components extremely easy. Problem: COM Automation across multiple COM versions
