Thanks mmzozeiko that got me on the right track.
As with Casey on the stream there were issues with PDB files getting locked. HMH compiles using its build.bat with compiler and linker flags that I have very little knowledge on and don't feel like investing my time in at this time. So I wanted to keep things as simple as possible and try to let VS handle as much as possible. Yet it gave me this look telling me to stuff myself for wanting to define a custom PDB filename.
In HMH build.bat the PDB file name uses %random% to circumvent the PDB locking issue providing the name to CL.exe with the /PDB argument. However I am using MSBuild.exe to compile using the vsproj files. And MSBuild.exe wants to know nothing about any PDB filename, it will use the one defined in the project file and nothing else. Trying to add arguments in the project's linker command line settings was fruitless as %random% was not supported and as far as I know there are no VS macros to echo either dates or random numbers.
After some experimenting and banging my head against a wall I found out that you can still tell the linker to output a specific PDB filename by providing a props file that looks something like this.
| <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<Link>
<ProgramDatabaseFile>..\Bin\Game_583510127.pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
</Project>
|
Using the same method as in the other thread I used an external tool hotkey to run the following batfile.
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | call "C:\Program Files (x86)\Microsoft Visual Studio 13.0\VC\vcvarsall.bat"
type nul>Bin\compiling.tmp
REM We delete all not-in-use PDB's. This means if we compile multiple times we'll get a big list of PDBs which will be deleted next clean run we do.
del Bin\*.pdb
REM Create our simple PROPS file that MSBUILD takes with a unique PDB filename.
call PropsBuilder.exe
REM I'm too dumb to get a relative path to work for the PROPS file.
call msbuild.exe /VERBOSITY:minimal Uluru.sln /target:Game /p:ForceImportBeforeCppTargets="D:\Development\Personal Projects\SVN-ed\Projects\Uluru\game_overrides.props";Platform=x86
del Bin\compiling.tmp
echo Compiling done.
|
Now there are two caveats. First is that I couldn't get the bat file to properly output that kind of XML without having to account for characters such as " and < >. It would mess up the commands and complain about unexpected characters, it's to be expected but because I wanted to see if it would work at all I created a small program (PropsBuilder.exe) that just generates the props file with a random number in the PDB filename. Another caveat, as stated in the bat file, is that PDBs start to pile up and only get removed the next time the old ones aren't locked. Minor gripe but I don't really care for now. On a side note, in my testing I made the Linker/Debugging/Generate Program Database File setting empty in the project file, if that does anything who knows? Oh and the absolute path makes me want to cry but hey, it's working now so I'm a happy camper.