3

I have old project that uses WCF from withing C# CLR triggers for SQL Server. I was always installing it by running a script.

But I've decided to move on to SSDT project on VS 2012. I've imported project from empty database. WCF functionality depends on several assemblies from .net framework

SMdiagnostics
System.Web
System.Messaging
system.identitymodel
system.identitymodel.selectors
microsoft.transactions.bridge
System.ServiceModel

So I have a reference to these dlls in my project. I also had them added to my project under Assemblies sub folder.

However when I create a deployment script, these assemblies are not in it.

So when I try to publish script to database I receive an error.

Assembly 'system.servicemodel, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog.

If I try to create custom script to add assemblies to db :

create assembly [SMdiagnostics]
from  'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMdiagnostics.dll'
with permission_set = unsafe
go

I receive error

Error: SQL70502: The assembly source is not valid. Only binary literals are allowed.

How can I add assembly from .NET to be deployed along with my SSDT project?

Thanks.

4

1 回答 1

14

要将 .NET 程序集添加到 SSDT 项目:

  1. 在解决方案资源管理器中,展开项目并右键单击引用。
  2. 在“添加引用”窗口中,浏览程序集或从“程序集”类别中进行选择。
  3. 右键单击添加的程序集,然后单击属性。
  4. 确保设置了这些属性:
    • 生成 Sql 脚本:真
    • 模型感知:真
    • 权限集:安全/外部/不安全(取决于组件)
  5. 按 F5 部署到 LocalDB/Debug 目标或选择 Publish and Generate Script 以验证更改。

DACPAC(SSDT 构建的结果)不允许 CREATE ASSEMBLY 使用路径,因为不包含 DLL 并且无法保证路径在另一台主机上。因此,DACPAC 中只允许嵌入二进制文字。

于 2013-11-15T20:01:29.260 回答