MSBUILD Error : MSB4115 The "exists" function only accepts a scalar value
- Any ideas for getting around this one:
(InitializeBuild target) ->
C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(743,11): error MSB4115: The "exists" function only accepts a scalar value, but its argument "$(SolutionRoot)" evaluates to "C:\B\1\ExpertSuite\VS2010.Libraries.Foundation\Sources;C:\B\1\ExpertSuite\VS2010.Libraries.Foundation\Sources" which is not a scalar value.
Have looked at :
http://msdn.microsoft.com/en-us/library/7szfhaft%28VS.100%29.aspx
From the link above the condition used is valid and Exists should accept a String. So the target in Microsoft.TeamFoundation.Build.Targets should be valid. But its reporting an error that Exists only accepts a scalar value. This condition is used through out Microsoft.TeamFoundation.Build.Targets.
Answers
- You can put it into an item and then batch on it.
For example:
<Project ToolsVersion="3.5" xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
<Target Name="Demo"><ItemGroup>
<_SlnRootItem Include="$(SolutionRoot)"/>
</ItemGroup>
<Message Text="exists" Condition="Exists('%(_SlnRootItem.FullPath)')"/>
<Message Text="not exists" Condition="!Exists('%(_SlnRootItem.FullPath)')"/>
</Target>
Task Batching, which is started by the %() syntax, will cause the task to be executed once for ecah unique batch. Here are some links for more details.
</Project>
MSBuild Batching Part 1
MSBuild Batching Part 2
MSBuild Batching Part 3
MSBuild RE: Enforcing the Build Agent in a Team Build
My Book: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build
My Blog: sedodream.com
Visual C# MVP- Marked As Answer byChao KuoMSFT, ModeratorWednesday, November 11, 2009 3:00 AM
- Proposed As Answer byChao KuoMSFT, ModeratorMonday, November 09, 2009 5:44 AM
All Replies
- You can put it into an item and then batch on it.
For example:
<Project ToolsVersion="3.5" xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
<Target Name="Demo"><ItemGroup>
<_SlnRootItem Include="$(SolutionRoot)"/>
</ItemGroup>
<Message Text="exists" Condition="Exists('%(_SlnRootItem.FullPath)')"/>
<Message Text="not exists" Condition="!Exists('%(_SlnRootItem.FullPath)')"/>
</Target>
Task Batching, which is started by the %() syntax, will cause the task to be executed once for ecah unique batch. Here are some links for more details.
</Project>
MSBuild Batching Part 1
MSBuild Batching Part 2
MSBuild Batching Part 3
MSBuild RE: Enforcing the Build Agent in a Team Build
My Book: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build
My Blog: sedodream.com
Visual C# MVP- Marked As Answer byChao KuoMSFT, ModeratorWednesday, November 11, 2009 3:00 AM
- Proposed As Answer byChao KuoMSFT, ModeratorMonday, November 09, 2009 5:44 AM
- Thank you for the response, but I found the following.
It was picking up an older version from "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" and then loading the newer version from "C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets". This was causing a conflict of some type.
I stopped it from picking up the older version and the error went away. This was achieved by commenting out nearly every step in the build and then slowly adding in the steps/targets untill it broke again. Knowing at what point it was breaking it was easy to then diagnose.


