views:

812

answers:

1

We are using a COM DLL provided by Microsoft (dsofile.dll) in a C# dll written by us (Assembly A). In order to avoid having to register the COM dll, I have switched the Isolated property on the reference to dsofile.dll to true.

This means that when we compile our dll, visual studio copies dsofile.dll, Interop.DSOfile.dll and Native manifest files to the bin folders of our solution and the application can run without the dsofile.dll being registered.

This approach was successful in a small test application.

However, in the real application, Assembly A is referenced by some of our other dlls (Assembly B and Assembly C) and the application EXE. When the native manifest file and interop dll are copied to the application's bin folder, different copies of each of the files are being used since each dll referencing our first dll creates its own copy.

This results in multiple copies of the files showing up as references in the setup project (ie dsofile.dll from the Assembly A, B and C and EXE folders, Interop.DSOFile.dll from the Assembly A, B and C and EXE folders, Native.Assembly A.manifest from the Assembly A, B and C and EXE folders) and compiler warnings ('Two or more objects have the same target location').

In addition, if the manifest and interop dll which were copied into the final folder did not come directly from the Assembly A folder (since the duplicate files overwrite one another), the application cannot successfully load the COM DLL.

I have been forced to manually exclude the duplicate copes of the files from the setup dependencies but they reappear when the solution is reloaded or rebuilt.

Can anyone help with a better method to achieve isolated deployment of the COM dll? I would also like to embed the manifests if possible but I have not been successful in doing this so far.

As an alternative I have been investigating the automation of the task of excluding the duplicate copies using EnvDTE for Visual Studio Automation but have not been able to discover how to access the Detected Dependencies nodes in a way that allows me to identify and exclude them. Accessing them with the UIHierarchyItem interface shows the name of the setup project as the name property for every file and does not have an exclude option.

Any advice would be appreciated.

A: 

You've probably got this solved by now...

Anyways, I've resolved a similar problem in the past by making reference to projects instead of to the assemblies themselves. The deploy project has some problems with multiple references to assemblies that are being built in the solution.

Scott P