如何在 VSTS 构建期间使用 OctoPack 避免 XML 文件中的无效字符?

Posted

技术标签:

【中文标题】如何在 VSTS 构建期间使用 OctoPack 避免 XML 文件中的无效字符?【英文标题】:How do I avoid invalid characters in XML files using OctoPack during VSTS builds? 【发布时间】:2016-09-05 15:35:45 【问题描述】:

我在构建过程中看到这些错误。

C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4\bin\.NETFramework\Microsoft.Data.Services.Client.xml' contains invalid characters.
C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4\bin\.NETFramework\Microsoft.Data.OData.xml' contains invalid characters
C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4\bin\.NETFramework\Microsoft.Data.Edm.xml' contains invalid characters.
C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4\bin\.NETFramework\System.Spatial.xml' contains invalid characters.

当我以相同的参数运行 MsBuild 时,我没有在本地获取它们,我什至可以在私有构建代理上运行 MSBuild 也很好。

我有其他项目使用 OctoPack 就好了,并且使用这些包。我会仔细检查它们,因为其他的都很好。

【问题讨论】:

【参考方案1】:

通过将受影响的软件包从 5.6.4 升级到 5.7.0(当前最新版本)来解决问题。

我花了好几个小时试图弄清楚这一点。我想我可以通过发布我本来会问的问题以及答案来节省其他人的时间。

还要确保你的主要目标的 App.config/web.config 也有绑定重定向:

<dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
      </dependentAssembly>

您可能在解决方案的服务/实用程序项目中拥有这些,但如果它们不在“可部署”目标的主配置文件中,它们将被忽略,您可能仍会选择对

C:\Program Files (x86)\Microsoft WCF Data Services\5.6.4

“包”文件夹中的 DLL 版本,而不是您想要的 NuGet 打包版本。

【讨论】:

以上是关于如何在 VSTS 构建期间使用 OctoPack 避免 XML 文件中的无效字符?的主要内容,如果未能解决你的问题,请参考以下文章

Octopack 工件包括源代码

vs 团队服务使用提交消息触发构建

Jenkins 使用 OctoPack 和 ReadyRoll 构建警告“源文件不存在”

如何检索在 VSTS 中触发构建时使用的构建参数(使用 REST API)?

VSTS无法加载源401的服务索引

VSTS:如何重新排队损坏的构建和切换代理队列