0 votes
ago by (120 points)

Hi,

I've inherited a legacy SQL CLR C# project which references extensively the SFTP, Common and Networking rebex DLLs. I have the source code from devops but not these dlls specifically so I had to source them independently (all version 5.0.7077.0) and reference them in the project.

I don't have access to the GAC or Nuget so I have been referencing them to the filesystem but I cannot get the compiler to 'see' the dlls. I have tried various places including the project's bin folder and the local .Net 2.0 folder in C:\Windows\Microsoft.NET\Framework\v2.0.50727 but nothing I do works.

I have cleaned the project, removed all references including rebex and readded, checked the project is targeting .Net 2.0. C# is not my bread and butter so I'm stuck on what next to try. Any help greatly appreciated!

Applies to: Rebex SFTP

1 Answer

0 votes
ago by (18.1k points)

Hello,

If I understand you right, your problem is in compiling the project in Visual Studio, not in executing it within the SQL Server?

If it is so, putting libraries into GAC does not matter here. You have to reference the DLLs from the directory they are stored on your dev computer. If the package has been downloaded and installed from your Rebex account , they are usually stored in the c:\Program Files (x86)\Rebex Components 2019 R2\bin\net-2.0 directory.

Such referencing is also described in our blogpost.

Please try to reproduce the referencing on the clean project as descibed in the blogpost. If the clean project works fine, please try to describe us differences between the clean project and your inherited project. It would also help us to know the version of Visual Studio you are using.

ago by (120 points)
Hi,

Thanks for your help and response.

I am on VS2022 Community, but I have followed the instructions to create the clean project using VS2019 Community - with the same result. The issue looks to be the dlls themselves and possibly the way I have acquired them. I pulled them out of a nuget packages I downloaded from nuget.org as I needed the 5.0.7077 versions of the dlls. Within VS2019 (and 2022) intellisense works - I can drill down through the class hierarcies, I can create a line of code to instantiate a class (and it compiles), but as soon as I include a 'using' line or try to reference a method within the instantiated class I get compilation errors about the dll not being referenced and compilation fails.

Does this sound like the nuget methodology is not working and I need a rebex account to obtain the dlls? The other alternative is I try and see if I can obtain the original 5.0.7077 dlls from the old developer's laptop or alternatively export them back out from the host SQL server...? I am working on behalf of a client who has no internal resource and really needs the help. I believe they are licensed but have no details on that...I could ask.
ago by (18.1k points)
Hi,

I'm sorry, but I don't have any ideas how to help you with the information I have from you.

I expect you have checked that all the three referenced DLLs (`Rebex.Common.dll`, `Rebex.Networking.dll` and `Rebex.Sftp.dll `) have the same assembly version.

I don't think there could be something wrong on obtaining the DLLs from nuget.org.  

To help you more, please send me some details about the error that occurs in your project. Does the error occur even in the sample code from our blogpost (https://blog.rebex.net/how-to-upload-data-to-ftp-or-sftp-server-from-a-sql-clr-procedure#implementbodyofthestoredproceduremethod)? If it is a more complicated code, send me a screenshot of the failing section. It may also help me to send the exect compilation errors.

I'm not sure if it helps, but with the information you already sent me, I'm stuck.
ago by (120 points)
Hi Jan,

Thanks for your continued patience!

Yes, it is using the exact same code as is in the blogpost. How can I send you the screenshots of what I am seeing?
ago by (18.1k points)
Send us e-mail to support@rebex.net
...