无法加载文件或程序集'Microsoft.SqlServer.BatchParser,Version = 13.100.0.0

问题描述 投票:0回答:2

我正在尝试在TFS 2018中运行构建。我们还在TFS构建服务器(Windows Server 2016)上安装了SQL Server 2016。 Visual Studio是2017年。第一个解决方案文件产生以下错误,我不知道该文件的引用位置: 2019-01-22T20:35:26.8607312Z包装: 2019-01-22T20:35:26.8608029Z调用Web Deploy以使用以下设置生成包: 2019-01-22T20:35:26.8608667Z $(LocalIisVersion)是10 2019-01-22T20:35:26.8609527Z $(DestinationIisVersion)是10 2019-01-22T20:35:26.8610846Z $(UseIis)为True 2019-01-22T20:35:26.8612479Z $(IisUrl)是http://localhost:62327/ 2019-01-22T20:35:26.8614266Z $(IncludeIisSettings)为False 2019-01-22T20:35:26.8615630Z $(_ DeploymentUseIis)为False 2019-01-22T20:35:26.8617245Z $(DestinationUseIis)为False 2019-01-22T20:35:26.8666548Z GenerateMsdeployManifestFiles: 2019-01-22T20:35:26.8684620Z为Web Deploy打包/发布生成源清单文件... 2019-01-22T20:35:27.0589951Z Visual Studio是2017. ## [错误] C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ MSBuild \ Microsoft \ VisualStudio \ v15.0 \ Web \ Deploy \ Microsoft.Web.Publishing.MSDeploy.Common.targets(119,5):错误MSB4018:“SqlScriptPreprocessSqlVariables”任务意外失败。 System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.SqlServer.BatchParser,Version = 13.100.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91”或其依赖项之一。该系统找不到指定的文件。 文件名:'Microsoft.SqlServer.BatchParser,Version = 13.100.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91' 在Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute() 在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 在Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

警告:装配绑定日志记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog](DWORD)设置为1。 注意:程序集绑定失败日志记录会导致一些性能损失。 要关闭此功能,请删除注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog]。

visual-studio-2017 tfsbuild tfs2018
2个回答
0
投票

找到了一个解决方法here,用于桌面构建。没试过TFS团队建设。

使用gacutil注册随Visual Studio 2017安装的Microsoft.SqlServer.BatchParser v2015.130.1601.5,即使请求v13.100.0.0,也显然满足构建任务SqlScriptPreprocessSqlVariables。

在:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLCommon\130

或类似的问题:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\gacutil.exe" /i Microsoft.SqlServer.BatchParser.dll

或类似的。


0
投票

找到了workaround所指的Michiel

我的情况:

  • Visual Studio 2017构建工具(无IDE)
  • Microsoft.SqlServer.BatchParser Version = 13.100.0.0未在全局程序集缓存中注册。两者都不是13.0.0.0。
  • VS Build Tools不包含Microsoft.SqlServer.BatchParser.dll。引用的路径适用于VS Enterprise,而构建工具不存在:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLCommon\130。在C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools下没有类似的路径
  • 我检查了Build Tools的安装。说安装了SQL Server数据工具 - 在数据存储和处理工作负载下

我的解决方案

  • 根据推荐here,我下载并安装了SQL Server数据工具,然后重新启动。
  • 这使得在全局程序集缓存中注册了Microsoft.SqlServer.BatchParser Version = 13.0.0.0
  • 然后,根据有问题的解决方法(上面的developercommunity),我为MSBuild添加了一个绑定重定向(在C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\BinMSBuild.exe.config中 - 见下文)
  • 固定。
<!-- Workaround for errorMSB4018: The "SqlScriptPreprocessSqlVariables" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=13.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. -->
<dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.BatchParser" culture="neutral" publicKeyToken="89845dcd8080cc91" />
    <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="13.0.0.0"/>
</dependentAssembly>
© www.soinside.com 2019 - 2024. All rights reserved.