Brahmaprasad R
Brahmaprasad R

Reputation: 129

Can a .NET assembly in framework 4.5 refer to old GAC?

I know that there are two GACs will be available on a system where latest .NET framework is installed. i.e. "C:\Windows\assembly" for framework lower than 3.5, and "C:\Windows\Microsoft.NET\assembly\GAC_MSIL" for 4.0 and above.

Now, I have two questions:

First question is, I've a C#.NET assembly developed in frawework 4.5 and i have to add a reference to Microsoft.Office.Interop.InfoPath.Xml.dll. I'm not finding this reference in the latest GAC, but it is there in the old one. So can I add from the old GAC?

Second question : If I install a latest version of Office, this reference also get migrated to another version. So unless I re-refer this dll in my project, my assembly cannot load the mentioned dll as it is checking for exact version number. Is there a generic solution for this, so that I need not change the reference and rebuild my application?

Upvotes: 1

Views: 920

Answers (1)

Murray Foxcroft
Murray Foxcroft

Reputation: 13785

Remove the references to the GAC and use the assemblies from the file system. Set CopyLocal = TRUE;

You may need more than the one Assembly, an article here - InfoPath Interop describes the assemblies required.

The InfoPath primary interop assemblies can be downloaded here: http://msdn.microsoft.com/en-us/library/15s06t57.aspx

Upvotes: 1

Related Questions