SQL CLR项目构建使用TFS失败 - 无法解析对程序集的引用

时间:2011-05-16 17:21:16

标签: visual-studio-2010 tfs msbuild sqlclr

我们有一个VS2010解决方案,其中包含一个SQL CLR项目,该项目本身引用了已在我们的开发数据库服务器上注册的第三方程序集(通过解决方案中的数据库项目,该项目具有使用脚本注册程序集的脚本从varbinary文字中创建ASSEMBLY。

当我们尝试通过TFS运行构建时,CLR项目无法构建,因为它无法找到对程序集的引用(下面的错误消息)

ResolveSQLCLRReferences:
  Primary reference "Telerik_Web_UI_RecurrenceEngine".
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets(147,7): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Telerik_Web_UI_RecurrenceEngine". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [..]
      For SearchPath "xx\obj\sqlclr".
      Considered "xx\obj\sqlclr\Telerik_Web_UI_RecurrenceEngine.dll", but it didn't exist.
      Considered "xx\obj\sqlclr\Telerik_Web_UI_RecurrenceEngine.exe", but it didn't exist.
ResolveAssemblyReferences:
  Ignoring "Telerik_Web_UI_RecurrenceEngine" because it has a non-empty subtype "SQLCLR".

通过VS构建/部署时,这很好。我注意到我在本地的obj \ sqlcr文件夹中有所需的DLL文件,我假设它是从项目引用到SQL Server上的程序集生成的。

我们是否需要签入此文件以便构建服务器可以找到它或者是否有某种方法使msbuild连接到数据库服务器以解析引用?

或者我们应该从DB项目中的文件(而不是varbinary文字)注册程序集,然后让CLR项目引用它? (不确定如何,手动复制到\ obj \ sqclr文件夹可能?)。任何指导赞赏!

1 个答案:

答案 0 :(得分:0)

在其他项目文件中签入文件可以替代,但您必须确保在Team Build服务器上也可以找到文件引用。

由于这是第三个parth库dll,我相信它不会经常更改,因此将dll放在Team Build服务器的GAC中也可能有效。 (......并且是一个更清洁的解决方案。)