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.
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.