Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Microsoft.VisualStudio.Web.targets from Mono?

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

like image 900
RelayRanger Avatar asked Sep 18 '26 06:09

RelayRanger


1 Answers

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)')
like image 87
Rob McCready Avatar answered Sep 21 '26 04:09

Rob McCready



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!