为了在基于Mono的CI构建中使用Microsoft.VisualStudio.Web.Publishing.targets中的TransformWebConfig
和Package
任务,我对MSBuild.Microsoft.VisualStudio.Web.target
NuGet包进行了依赖,并将项目文件更新为Import。该构建可与MSBuild正常运行,但xbuild无法处理目标文件:
无法解析条件“'$(EnableWebPublishProfileFile)'=='true'和'$(WebPublishProfileFile)'!=并存在($(WebPublishProfileFile))”:在条件“'$(EnableWebPublishProfileFile)中应有位置90的属性)'=='true'和'$(WebPublishProfileFile)'!=并存在($(WebPublishProfileFile))“。'$'之后缺少开头括号。
实际上,这是我明确尝试导入时的错误Microsoft.Web.Publishing.targets
;通常是通过进口过渡进口的Microsoft.WebApplication.targets
。我认为xbuild仅在导入后者时(静默地)无法加载前者,因为我只是得到了错误:
错误:在项目中找不到名为“ TransformWebConfig”的目标。
再次,此生成与MSBuild正常工作。该项目文件具有以下Import指令:<Import Project="$(SolutionDir)\packages\MSBuild.Microsoft.VisualStudio.Web.targets\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" />
xbuild条件解析逻辑中似乎确实存在一个错误。看起来可以使用Exists内部的变量将单引号引起来
Exists('$(WebPublishProfileFile)')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句