You do not need to edit the CSProj file: just use the CMD.EXE syntax in Visual Studio Post-Build events
You can check if it works inside Visual Studio
IF "$(BuildingInsideVisualStudio)"=="true" (
…
)
or inside TFS Build (2013 or later)
IF "$(TF_BUILD)"=="True" (
…
)
. a
TFS 2010 Build Automation Team Foundation Build.