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

时间:2019-01-24 14:39:06

标签: visual-studio-2017 tfsbuild tfs2018

我正在尝试在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)是假
2019-01-22T20:35:26.8615630Z $ {__ DeploymentUseIis)是错误的
2019-01-22T20:35:26.8617245Z $ {DestinationUseIis)是错误的
2019-01-22T20:35:26.8666548Z GenerateMsdeployManifestFiles:
2019-01-22T20:35:26.8684620Z生成Web部署程序包/发布的源清单文件...
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,版本= 13.100.0.0,区域性=中性,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()

WRN:程序集绑定日志记录已关闭。
若要启用程序集绑定失败日志记录,请将注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog](DWORD)设置为1。
注意:与程序集绑定失败日志记录相关的性能损失。
要关闭此功能,请删除注册表值[HKLM \ Software \ Microsoft \ Fusion!EnableLog]。

2 个答案:

答案 0 :(得分:0)

找到了针对桌面版本的解决方法here。没有尝试建立TFS团队。

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

在:

public JPAMap() {

}

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

@ElementCollection
@JoinTable(name = "Tasks", joinColumns = @JoinColumn(name = "TASK_ID")

)

private Collection<Task> map = new ArrayList<Task>();

public Collection<Task> getMap() {
    return map;
}

public void setMap(Collection<Task> map) {
    this.map = map;
}

或类似问题:

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

或类似的

答案 1 :(得分:0)

找到与workaround所指的相同的Michiel

我的情况:

  • Visual Studio 2017生成工具(无IDE)
  • Microsoft.SqlServer.BatchParser版本= 13.100.0.0未注册在 全局程序集缓存。两者都不是13.0.0.0。
  • VS生成工具不包含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版本= 13.0.0.0
  • 然后,根据有问题的解决方法(上述开发者社区),我为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>