I want to add in a Post-build event commandline in my Visual Studio 2012 C# project.
I have a number of projects in my solution and I would like to add to the list of macros available with "Macros>>".
How can I achieve this?
For instance I have the command line:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f MYPFXFILEPATH /p MYPASSWORD /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetDir)$(TargetFileName)
I would hate to copy and paste that into every project. I would like to place the first part into a macro so that I would have:
$(SignCommandLinePrefix) $(TargetDir)$(TargetFileName)
Though you won't see your macro in the Macros>> list, you can edit your .csproj file by hand. Look for the first <PropertyGroup>
and add this right before the closing </PropertyGroup>
:
<SignCommandLinePrefix>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f MYPFXFILEPATH /p MYPASSWORD /t http://timestamp.verisign.com/scripts/timstamp.dll</SignCommandLinePrefix>
Now, you can add $(SignCommandLinePrefix) $(TargetDir)$(TargetFileName)
to your Post-Build Event and it will work just as you wish.
Check out Chuck England's response to this question: http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/e774f871-8fc2-4875-b791-1df3dd0bb2dc/