title: Visual Studio 2010 Post-Build Event : Passing Current FlavorToBuild
body: <p>I'm currently working on a re-platforming project, part of which involves a few dozen websites, all that use a common header. Several of these sites all lived on the same machine so a symbolic link was setup so they could all reference the same content. Certain other sites were external and so a common "includes.company.com" was setup and utilized.</p>
  
  <p>Fast forward to today and I'm attempting to setup up the "includes.company.com" site in Visual Studio. The content is simple enough. I've boiled it down to one HTML file and one CSS file along with all the necessary images.</p>
  
  <p>What I'm trying to accomplish now is based on current build configuration, to output the HTML and CSS with proper links that can be referenced from external sites.</p>
  
  <p>I currently have a post-build event that looks like so...</p>
  
  <pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file "$(MSBuildProjectDirectory)\pbuild.ps1" "$(Configuration)" $(MSBuildProjectDirectory)
  </code></pre>
  
  <p>where pbuild.ps1 looks like</p>
  
  <pre><code>param ([string]$config, [string]$target)
  
  If ($config -eq "Debug")
  {
      (get-content $target\common\css\stylesheet.min.css) -replace '{SERVER}', 'http://dev.includes.company.com' | set-content $target\Builds\$config\common\css\stylesheet.min.css
      (get-content $target\header.html) -replace '{SERVER}', 'http://dev.includes.company.com' | set-content $target\Builds\$config\header.html
  }
  
  If ($config -eq "QA")
  {
      (get-content $target\common\css\stylesheet.min.css) -replace '{SERVER}', 'http://qa.includes.company.com' | set-content $target\Builds\$config\common\css\stylesheet.min.css
      (get-content $target\header.html) -replace '{SERVER}', 'http://qa.includes.company.com' | set-content $target\Builds\$config\header.html
  }
  
  If ($config -eq "Release")
  {
      (get-content $target\common\css\stylesheet.min.css) -replace '{SERVER}', 'http://includes.company.com' | set-content  $target\Builds\$config\common\css\stylesheet.min.css
      (get-content $target\header.html) -replace '{SERVER}', 'http://includes.company.com' | set-content $target\Builds\$config\header.html
  }
  </code></pre>
  
  <p>This works great for Debug, and Release, but not QA. As I've come to find out, the variable $Configuration seems to only ever contain 'Debug' or 'Release' and not the actual Active Configuration I'm looking for.</p>
  
  <p>FlavorToBuild seemed promising but I'm having a hell of a time getting that pulled out into a variable that I can use.</p>
  
  <p>Is there a variable that is setup to give me what I'm looking for, the name of the active build configuration? Is there a way to assign a variable in the project file that I can then feed into my Post-Build event? This is my first real foray into this world so any help or guidance on how to achieve this goal is highly appreciated. </p>