Hi. I have a ton of files in my source repository which aren't even used in my build. I know a few of them, but I know that there are a ton more. Our build script is pretty antiquated and is a mish-mash of MSBuild, .BAT file, Perl and more. Can anyone tell me if there is a way to run my build, and then output a list of all the files which WEREN'T read as part of it?
Assuming you're using NTFS, you can do a build, then wait for at least an hour, then check on which files the access timestamp is before the start of the build. In Perl, for example, the access time can be retrieved by the GetFileTime
function from the Win32API
module. Running through a directory tree in Perl is described here. (Note that README files etc. are likely not touched upon, so maybe filter for known source code file extensions.)
Your best bet without writing code to hook into Windows is to use a tool which monitors disk activity. For example you could Process Monitor from the Sysinternals suite.
When you launch Process Monitor to the menu item Filter->Filter... which will pop open a dialog. In that dialog you should filter the results to only show activity under the path where you are building. In my example I created a dummy solution under the folder C:\temp_NET\ThrowAway\WebApplication2. So in order to filter to results only under this folder I added the filter shown in the image below.
After you do this you should run a build, then export the results from process monitor to a file and mine that file for modifications.
I would make sure that you are doing a full build, because if you are not then files may not be touched because targets might get skipped if they are up to date.