I am using the default build template for Visual Studio 2013. I have been using the pre-build script/post-build script options to run Powershell scripts for some time. I have been able to access environment variables in these scripts, but now I need to access properties defined in the Visual Studio project. The specific property I want to access in a post-build Powershell script is $Configuration.
I open the diagnostics of the builds I am executing. I can confirm that the property is passed into the msbuild execution to build the project like this
/p:Configuration="Release"
I add to the post-build script arguments like this (I have also tried this with single quotes/double quotes/all caps)
-Configuration $Configuration
In the Powershell script itself I access the property value through the param like this:
[CmdletBinding()]
param(
[string]$Configuration
)
I then try to write out the value of this parameter in the Powershell script like this
Write-Host "Checking Configuration: " + $Configuration
I can see this line when I look at the diagnostics from the build, but the problem is that the value of the parameter is always the string literal I pass into the post-build script arguments, but never the replacement parameter value of Debug or Release. Here are some examples of what gets printed
Checking Configuration: $Configuration
Checking Configuration: "$Configuration"
Checking Configuration: '$Configuration'
Checking Configuration: $CONFIGURATION
Is it possible to do what I am trying to do - are project properties available to the post-build scripts? It seems like this should be possible from reading other questions on this site as well as posts on other sites. Is there something simple of complex I am missing? Thanks!

-Configuration $(Configuration)for passing the argument? That's how it's normally done within the VS settings, since it goes like that into the project files which are interpreted by msbuild and $(property) is the syntax used by msbuild - stijn