Reputation: 1321
Problem: Editings .props files with msbuild is failing. I'd like to see what the intermediate results of operations are doing with some output message. " is not supported" is the what the IDE is telling me.
Example: I want to get the last four characters of the configuration name to use a part of a string.
<ImportGroup Label="PropertySheets">
<Import project=".\prop_$(Configuration.Substring($([MSBuild]::Subtract($(Configuration.Length),4)) )).props" />
</ImportGroup>
How can I see the results of the parts, the length, the subtract, the substring? I want to be able to print out these values during the processing.
Upvotes: 1
Views: 328
Reputation: 1637
You can use the Message Task
example: At the top of the project set InitialTargets to the name of your Target
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="DisplayText">
<Target Name="DisplayText">
<Message Importance="high" Text="Configuration = $(Configuration)" />
<Message Importance="high" Text="Configuration Length = $(Configuration.Length)" />
<Message Importance="high" Text="Configuration Substring = $(Configuration.Substring($([MSBuild]::Subtract($(Configuration.Length),4))))" />
</Target>
That should print out everything you asked about during the build process.
1>------ Build started: Project: TemplateTest, Configuration: Debug Win32 ------
1> Configuration = Debug
1> Configuration Length = 5
1> Configuration Substring = ebug
Upvotes: 2