3

I am trying to organize my VS 2010 solution. One area that is holding me back is the use of Unmanaged DLLs. I can’t add them as References because the DLLs are unmanaged. The previous approach was to xcopy the DLLs from a “lib” folder during the Pre/Post build events to the output folder. The downside of this was the unnecessary copying that occurs for every build and also the clean operation never removed the DLLs from the output folder.

My ideal solution would be to consolidate the DLLs in a VS lib folder and make use of the “Copy If Newer” feature. However, VS creates a lib folder in the output folder and places the DLLs there. Please note that I do not prefer to have the DLLs on the top level of my Project tree. There are a lot of DLLs and this seems to pollute the Project.

1 Answers1

1

I'd go back to post build steps but use xcopy /d (only copies if newer), and use a step like this How to create custom clean (post-clean) event in Visual Studio 2008? to implement a custom clean.

You can avoid the duplicate lists of files by just getting the list in each case and executing on them.

Pre build event are are just batch scripts

and you can use MSBUILD batching to create the list that the clean step works on.

If you want you could write a beforecompile step in the msbuild script that would copy the files from source to target instead of a prebuild step in VS.

Community
  • 1
  • 1
Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
  • In this case I have to have 2 lists of all unmanaged DLLs: one in xcopy routine, second in clean event. There should be better way... – Vitalii Zabolotnyi May 02 '12 at 13:30
  • Sometimes engineering has bits of wire sticking out that might not appeal to ones sense of the aesthetic. Sure you could develop an extension that did just what you need- but at what cost :-) – Preet Sangha May 02 '12 at 20:44