How To: Conditionally Apply Metadata to Items

Last week we got a great question over on our forum about applying metadata to items depending on a condition. What the author wanted to was something like this:

  <Compile Include="">
   <DefineConstants Condition=" '$(Configuration)' == 'Debug'>OnForThisFile</DefineConstants>

It isn't documented in our MSDN reference (which we'll get fixed), but as the original author discovered this works exactly as you'd hope. Pretty nifty!

[ Author: Neil Enns ]

Comments (0)

Skip to main content