title: Getting "Reference Assemblies" path in MSBuild
body: <p>I'm updating a build to be compatible with .NET 4.5, and one of the changes I need to make is <a href="http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx" rel="nofollow">updating how I call ilmerge</a>.</p>
  
  <p>From the link above, this basically means changing:</p>
  
  <pre><code>/targetplatform:"v4,C:\windows\Microsoft.NET\Framework\v4.0.30319"
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>/targetplatform:"v4,C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
  </code></pre>
  
  <p>In my MSBuild AfterBuild target I was generating the former using <code>$(MSBuildToolsPath)</code>, like this:</p>
  
  <pre><code>/targetplatform:v4,$(MSBuildToolsPath)
  </code></pre>
  
  <p>What's the best way to translate this into the required <code>/targetplatform:"v4,C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"</code> path so that it works on x64, x86 or any unusual places it can wind up installed?</p>