Skip to main content David Edelstein's Blog

🦙
🦙

Visual Studio post-build powershell

Published: 2013-11-14
dave@edelsteinautomotive.com
David Edelstein

Put this into your visual studio post-build event commandline to export all the macro variables to your next command.

set OutDir=$(OutDir)
set ConfigurationName=$(OutDir)
Set ProjectName=$(ProjectName)
set TargetName=$(TargetName)
set TargetPath=$(TargetPath)
set ProjectPath=$(ProjectPath)
set TargetFileName=$(TargetFileName)
set DevEnvDir=$(DevEnvDir)
set TargetDir=$(TargetDir)
set ProjectDir=$(ProjectDir)
set SolutionFileName=$(SolutionFileName)
set SolutionPath=$(SolutionPath)
set SolutionDir=$(SolutionDir)
set SolutionName=$(SolutionName)
set PlatformName=$(PlatformName)
set ProjectExt=$(ProjectExt)
set SolutionExt=$(SolutionExt)

Then, you can invoke a powershell script that lives in your project directory that does a deployment.

powershell "Set-ExecutionPolicy RemoteSigned; & ""$(ProjectDir)postbuild.ps1"""