You do not need to edit the CSProj file: just use CMD.EXE syntax in Visual Studio Post-Build events
You can test if running inside Visual Studio
IF "$(BuildingInsideVisualStudio)"=="true" (…)
or inside TFS Build (2013 or later)
IF "$(TF_BUILD)"=="True" (…)
See the discussion aTFS 2010 Build Automation and post-build event and Team Foundation Build environment variables.