【问题标题】:using Microsoft.VisualStudio.Web.targets from Mono?使用 Mono 中的 Microsoft.VisualStudio.Web.targets?
【发布时间】:2015-04-30 16:44:01
【问题描述】:

为了在基于 Mono 的 CI 构建中使用来自 Microsoft.VisualStudio.Web.Publishing.targets 的 TransformWebConfigPackage 任务,我依赖于 MSBuild.Microsoft.VisualStudio.Web.target NuGet 包并更新了我的项目文件以导入它。构建与 MSBuild 一起工作正常,但 xbuild 无法处理目标文件:

无法解析条件“'$(EnableWebPublishProfileFile)'=='true' And '$(WebPublishProfileFile)' != '' And Exists($(WebPublishProfileFile))”:在条件“' 中需要位置 90 的属性$(EnableWebPublishProfileFile)'=='true' And '$(WebPublishProfileFile)' != '' And Exists($(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 不是 MSBuild,因此您应该接受它有缺陷且无能为力的事实。 Mono 人欢迎社区贡献,所以如果你愿意,可以修复这些错误。

标签: asp.net msbuild mono xbuild


【解决方案1】:

xbuild 条件解析逻辑中似乎确实有一个bug。看起来这可以通过 Exists 内的变量周围的单引号来解决

Exists('$(WebPublishProfileFile)')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-15
    • 1970-01-01
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    • 2012-07-02
    • 2011-02-12
    • 1970-01-01
    相关资源
    最近更新 更多