Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference c# class library in my Azure Function

Is it possible to reference a c# class library in an Azure Function visual studio project?

I am aware of the possibilities to reference external libraries and Nuget packages. Currently I am using shared .csx files as described here. These .csx files now contain a copy of my DTO's which are also used in the Service Agents which I use to consume the functions.

Ideally I want to add a reference in Visual Studio from a Function to a class library project and that Visual Studio is adding this dll to the bin folder.

like image 329
Wessel Kranenborg Avatar asked Dec 13 '16 07:12

Wessel Kranenborg


People also ask

Is there a reference in C?

We don't have reference variables or "aliases" in C. When we say "pass by reference" in C, we refer to the act of passing the pointer to a variable, to a function.

What is the reference C code?

The C Language Reference describes the C programming language as implemented in Microsoft C. The book's organization is based on the ANSI C standard (sometimes referred to as C89) with additional material on the Microsoft extensions to the ANSI C standard.

What is reference variable in C?

Master C and Embedded C Programming- Learn as you go Reference variable is an alternate name of already existing variable. It cannot be changed to refer another variable and should be initialized at the time of declaration and cannot be NULL. The operator '&' is used to declare reference variable.

How do references work in C?

The main use of references is acting as function formal parameters to support pass-by-reference. In an reference variable is passed into a function, the function works on the original copy (instead of a clone copy in pass-by-value). Changes inside the function are reflected outside the function.


1 Answers

Currently, project references are not supported, but you can have the output of your project (the resulting assembly and possible dependencies) copied onto a folder under your function's root, which you can then leverage using the external libraries support you've mentioned above (e.g. #r "..\myassemblyfolder\MyAssembly.dll")

If possible, I'd suggest opening an issue with that feature request, sharing more about your scenario on this repository. This allows other people to upvote those requests and helps the team prioritize this work.

like image 82
Fabio Cavalcante Avatar answered Sep 24 '22 10:09

Fabio Cavalcante