views:

34

answers:

1

My solution consists of several native, C++/CLI wrapper and managed libraries/assemblies. The wrapper projects are referencing different native DLL-projects. Every time i change an implementation detail in a .cpp file of a native dependency, all CLI/.NET projects are rebuilt (not just linked, but recompiled). This also happens in the Debug configuration (no Whole-Programm Optimization..). Is there any reason for this behavior? Since the solution is quite big, rebuilding takes alot of time so it would be nice if VS would avoid any unneccessary rebuilds.

+1  A: 

This is expected behavior. The .NET assemblies "depend" on the unmanaged DLL and when the DLL changes they detect that and re-build. The compilation unit of an unmanaged C++ project is a .cpp file. The compilation unit of a .NET assembly is the whole assembly. There's no way to re-compile just one .cs (or managed c++) file.

You can get around this by using ::GetProcAddress() to get function pointers to the operations in the unmanaged DLL's. Then you can remove the .NET assembly's dependency on the .lib file of the unmanaged DLL's and it will no longer re-compile every time the .lib changes.

David Gladfelter