I've run across msbuild syntax that I don't understand. The following snippet is from another question about making a custom msbuild task
<GenerateDesignerDC
InputFiles="@(dbml)"
OutputFiles="@(dbml->'$(IntermediateOutputPath)%(FileName).designer.cs')">
...
What does @(dbml->'$(IntermediateOutputPath)%(FileName).designer.cs')
mean? The @
sign usually references the files in an ItemGroup
; what does the ->
arrow inside an @(...)
mean?
What is this little language (with the @
s, $
s, %
s, ->
, etc.) used for substitutions into the attributes of build tasks called?
This specific syntax is called a transform.
The syntax isn't explicitly documented. The part before the
->
is an item list like that which would normally be referenced by@
. In the example@(dbml->...)
it is transforming thedbml
item list. The part after the->
is an expression for the new file name. It can refer to any item metadata with a%
symbol. In the example it's constructing a string with the$(IntermediateOutputPath)
property and the%(Filename)
well-known item metadata.The well-known item metadata should be available for any item and includes most notably the path to the item