Visual Studio itself copies all the assemblies ( dll'ки ) and the corresponding xml files into the output folder, if your project on .NET has links to them ( References ), and complex dependency graphs are automatically resolved. Taking into account that you are talking about copying xml files, presumably with the documentation for the assembly, we are talking about some managed assembly.
Thus, it can be assumed that you simply incorrectly set the References settings in your project, since the dll'ок copying necessary for launching the project should be copied automatically. Files with assembly xml documentation are also copied automatically.
If I make a mistake in my assumptions, I can offer you a more general solution. Instead of somehow cutting off extensions from file names and implementing some complex logic in Post-Build Events , do something like the following:
Define a lot of files that you always need to copy to the folder with the collected application (in your case there will be an additional dll'ка and the corresponding xml file).
Take a special folder for these files in your project. I use folders with data and static_data names in my projects.
The semantics of these names is as follows - data stores files without which the launch of an application or tests is impossible. It may be some input data, files for test cases, some unmanaged dll'ки , etc. The static_data contains auxiliary data that is simply used in the project - for example, graphical assets , UI sketches, important information in pdf'ках .
- Next in
Post-Build Events add the following command:
xcopy "$(SolutionDir)data\*.*" "$(TargetDir)" /S /E /Y
- With this you guarantee that if the project is successfully built, all the files from
data will be copied into the Output folder with the assembled application.
There is one more important point to which you should pay attention - if the files in the data folder are updated, they, naturally, will not be copied into Output before rebuilding the project, which means that at some point in time, despite the fact that you have already updated the files , the assembled application will work with the old set of files. This is quite critical for tests.