Similar to coryr (see this question), I am referencing a dll within a C# project. The DLL often changes but I the C# project does not recognize this. Unlike coryr, the DLL is a VB6 ActiveX DLL. Any suggestions for how to reload the reference other than removing and adding it?
The problem here is that when you add a reference to a COM DLL, you don't actually add a reference to the DLL. Instead a primary interop assembly is generated for the DLL and a reference is added to that. When the main DLL is changed a new PIA (primary interop assembly) is not generated.
You can verify this by doing the following
- Expand the references collection
- Hit F4. This will bring up the properties page
- Look at the path property
The path will be the path to the PIA.
The problem is that VS is watching the PIA and not the original DLL. So when the original DLL changes it doesn't actually reload the reference. The best way to get this to work is to unfortunately delete and re-add the reference.
Another solution is to manually generate the PIA and place it over the referenced PIA on disk. This will force VS to reload the DLL reference.