Back

[SOLVED]Deploying function with .dll reference C#

  • 0
  • Functions
  • Cloud
ilikechicken77
14 Jun, 2023, 10:12

I generated client code with swagger from the appwrite openapi specs. I've bee using it since without issues.

Now i wrote a simple function which creates documents in the database and therefore the code uses the swagger client code which is integrated using a reference to the IO.Swagger.dll.

So I put the .dll in the root directory of the project and edited the reference path in the .csproj file accordingly. Then I put the function files with the .dll in a tarball and tried to deploy it.

Unfortunately it throws an error (type or namespace could not be found) and I dont know how to resolve it after checking paths and doing some trial and error. I had the same problem with Newtonsoft which was also getting referenced locally but since there is a nuget package I could specify that one from the .csproj file and then it was working.

Maybe someone can help I am quite new to such topics and there is very little information out there..

TL;DR
User is having an issue deploying a function with a .dll reference in C#. They tried packing the DLL as a nuget package but still experiencing an error. They provided their function code and the file structure. Another user suggested adding the DLL as a reference through Visual Studio. User is still seeking help to resolve the issue.
Aditya Oberai
14 Jun, 2023, 15:00

@ilikechicken77 did you add the DLL to the project as a reference through Visual Studio?

Also, can you share your function code once and the function directory's complete file structure?

Aditya Oberai
19 Jun, 2023, 10:40

@Jake I created and tested a sample myself and there is a legitimate issue here.

Jake
19 Jun, 2023, 23:19

Can you please share the function archive and I'll see what I can see

Aditya Oberai
20 Jun, 2023, 08:57

Here's the function sample I created to try this: https://github.com/adityaoberai/DllTest-AppwriteFunction

Aditya Oberai
20 Jun, 2023, 09:00

In my function sample, src/TestClassLibrary.dll just contains the following class:

TypeScript
namespace TestClassLibrary
{
    public class Calculation
    {
        public int Add(int x, int y)
        {
            return x + y; 
        }
    }
}
Jake
20 Jun, 2023, 09:24

I see the problem - we're only processing PackageReferences at the moment. Please open an issue and we can try include a fix in the next release πŸ‘Œ

Aditya Oberai
20 Jun, 2023, 09:25

Will do in the OpenRuntimes repo πŸ‘

Aditya Oberai
20 Jun, 2023, 09:25

cc: @ilikechicken77

Aditya Oberai
20 Jun, 2023, 10:44
dieter
21 Jun, 2023, 13:18

thx guys I forgot that i posted.. I bypassed the issue by packing my DLL as a nuget package btw.

ilikechicken77
21 Jun, 2023, 13:23

[SOLVED]Deploying function with .dll reference C#

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more