SQL Server 程序集未显示在“添加引用”中对话
我有一个 VS2010 SQL Server 项目。我还有一个简单的 C# 库,我希望它可以引用。该库是纯.NET,它只进行一些字符串解析。我认为一旦该库位于 SQL Server 上,我就必须引用该库(但我可能是错的)。我已将库复制到服务器,并使用以下方法将其添加到 SQL Server:
CREATE ASSEMBLY MyAssembly
FROM 'F:\CLR\MyDll.dll'
WITH PERMISSION_SET = SAFE
该库显示在 sys.assemblies 中。但是,我无法将其添加为我的 SQL Server 项目中的参考。当我转到“添加引用... -> SQL Server”时,它不在列表中。
我不知道如何进一步调试这个问题,任何帮助将不胜感激。
I have a VS2010 SQL Server project. I also have a simple C# library that I'd like it to reference. The library is pure .NET, it just does some string parsing. I think that I have to reference the library once it's on SQL Server (but I might be wrong about that). I've copied the library to the server, and added it to SQL Server using:
CREATE ASSEMBLY MyAssembly
FROM 'F:\CLR\MyDll.dll'
WITH PERMISSION_SET = SAFE
The library shows up in sys.assemblies. However, I can't add it as a reference in my SQL Server project. When I go to "Add Reference... -> SQL Server", it's not in the list.
I'm not sure how to go about debugging this further, and any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了这个问题。我没有意识到 Assembly 对象是按数据库创建的,而不是按服务器创建的。我的 SQL Server 项目连接字符串没有指定初始目录,因此在“master”中查找,而不是在我创建程序集的数据库中查找。将字符串指向正确的数据库,然后它就可以工作了。
Solved this. I failed to realise that Assembly object are created per-database, not per-server. My SQL Server project connection string didn't specify an initial catalog, and as such was looking in "master", not in the database where I'd created my assembly. Point the string at the right database, and it works.