3

In an attempt to use the TransformWebConfig and Package tasks from Microsoft.VisualStudio.Web.Publishing.targets in a Mono-based CI build, I took a dependency on the MSBuild.Microsoft.VisualStudio.Web.target NuGet package and updated my project file to Import it. The build works fine with MSBuild, but xbuild is unable to process the targets file:

Unable to parse condition "'$(EnableWebPublishProfileFile)'=='true' And '$(WebPublishProfileFile)' != '' And Exists($(WebPublishProfileFile))" : Expected a property at position 90 in condition "'$(EnableWebPublishProfileFile)'=='true' And '$(WebPublishProfileFile)' != '' And Exists($(WebPublishProfileFile))". Missing opening parantheses after the '$'.

Actually, this is the error when I explicitly try to import Microsoft.Web.Publishing.targets; it is normally imported transitively by importing Microsoft.WebApplication.targets. I think xbuild is failing (silently) to load the former when I just import the latter, as I simply get the error:

error : Target named 'TransformWebConfig' not found in the project.

Again, this build works fine with MSBuild. The project file has the following Import directive: <Import Project="$(SolutionDir)\packages\MSBuild.Microsoft.VisualStudio.Web.targets\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" />

  • xbuild is not MSBuild, so you should accept the fact that it is buggy and could not do whatever. Mono guys welcome community contribution, so if you like you can fix those bugs. – Lex Li Feb 28 '15 at 03:16

1 Answers1

4

There does seem to be a bug in the xbuild conditional parsing logic. It looks like this can be worked around with single quotes around variable inside the Exists

Exists('$(WebPublishProfileFile)')
Rob McCready
  • 1,909
  • 1
  • 19
  • 20