Wednesday 6 September 2017

Azure Functions : .NET Standard or .NET Portable issues

Azure functions are the new kid on the block as Cloud technologies are pushing towards Serverless architectures. Azure functions is a powerful way to execute simple code blocks which need to be run on demand instead of requiring a dedicated hardware. It supports multiple programming languages e.g. C#, JavaScript, F# etc.

If you writing an Azure function using C#, there can be a case that you need to refer a dependency code block which is already part of a .NET dll. Well, if that is compiled is against different .NET flavors (remember Portable Class Library, .NET Standard, .NET Framework, .NET Framework client profile) then you might be wondering if that will work or not. Good news is that it works alright.

Here is a simple test. Create a simple timer based Azure Function from portal. I used C# as language.



As you see in the above function definition, I have referred to multiple DLLs, all compiled against different .NET Target Framework. Those DLLs are uploaded under "bin" folder.

All of the libraries have single class "Class1" and single method "SayHello" which prints different outputs for each library.


When you run the function, you can see that it is able to make use of all DLLs and print correct output.


So fear not and make use of available capabilities of Azure Functions.