Add an external assembly as a reference in the Azure function
WebSiteAdmin, December 3, 20188232 Views
Let’s learn today, how to add an external assembly as a reference in an azure function with a small example. This will help you to reuse the already developed functionalities (i.e.,) if there is a requirement that some of the functionalities are needed inside the azure function, which are already developed in any of the class library project then, this is possible by using a feature provided by the azure portal.
Let us consider that a class file in an assembly has the below lines of code in it.
namespace Automobiles { public class Cost { public static int GetCost() { return 5000; } } }
Now, if we want to use the above GetCost() method in our azure function then, we have to provide the reference of the above file in the azure function.
For that, open the “Function App” folder of the azure portal, where we can see the “App Service Editor” screen. Now, click on the “WWWROOT” folder, and then, under the required azure function, create a “bin” folder and add the Automobiles.dll library in it. This would look somewhat similar as the below screen shot:
After completing the above steps, include the below lines on the top of the azure function which specifies that the specified dll is being referenced as an external library:
#r "Automobiles.dll" using Automobiles;
Now, we can access the methods of the class in the above library using the absolute path as follows:
int cost = Cost.GetCost();
Below is a sample code using the above method:
I hope this helps you.
Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox
Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator