I want to be able to dynamically load and unload DLL projects at runtime. For this to work I have to make sure that each time I rebuild my project in Visual Studio the .pbd file generated has a pseudo-random generated name as (random file-path valid string).pbd.
This is because the debugger forces me to abort debugging before rebuilding otherwise.
I first tried creating a custom pre build tool that ran a .bat file that created a system enviroment variable like this:
set TIMESTAMP=%DATE:/=-%@%TIME::=-%
set TIMESTAMP=%TIMESTAMP: =%
setx buildrandomvar %TIMESTAMP%
And that worked fine, I checked the registry. But no matter what I did I just could not reference "buildrandomvar" as a part of the .pdb file name. The result was just an empty ".pbd".
My Program Database File Name setting is: $(OutDir)$(TargetName)$(buildrandomvar).pdb
I would really appreciate any help at all with this issue because I just can't get this to work.
I found the answer and I'll just put it here in case anyone ever needs it.
In Visual Studio, right click your project, go to Properties -> Linker -> Debugging -> Generate Program Database File and enter
"$(OutDir)$(TargetName)-$([System.DateTime]::Now.ToString("HH_mm_ss_fff")).pdb"
This should generate your pdb with a timestamp in the file name which is technically pseudo-random.