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" />

4

1 回答 1

4

xbuild 条件解析逻辑中似乎确实存在错误。看起来这可以通过 Exists 中的变量周围的单引号来解决

Exists('$(WebPublishProfileFile)')
于 2015-03-24T16:18:47.583 回答