I have a Visual Studio 2008 solution that has the following projects:
- a C++/ATL COM library
- a C# library that uses the COM library
- a C# unit test library (using MSTest) that references the other two libraries
The C++ COM library project has a Custom Build Step that builds a .NET interop library, which looks like this:
tlbimp /asmversion:1.1.0.0 "$(TargetPath)" /out:"c:\Libraries\MyProject.Interop.dll"
Then the C# library and the C# unit test library reference c:\Libraries\MyProject.Interop.dll
.
My problem is that when I make modifications to the IDL in the COM library, the library and the interop library get rebuilt, but the C# projects still have copies of the old interop libraries lying around in their output directories, and they don't get updated. I have to manually delete those older libraries to get the new one to be recognized.
I can almost get this to work by setting the Copy Local property for the reference in the C# projects to False. But then I have problems running the unit tests, because the interop library doesn't get copied to the test deployment location.
I can hack around this by adding more custom build steps to delete and/or copy libraries around, or by futzing with the unit-test deployment, but is there some easy way to get Visual Studio to just use the updated interop library everywhere when it changes?