Reputation: 1440
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.
Upvotes: 14
Views: 8555
Reputation: 1440
Previously this was not possible. This is now possible as you can read here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library.
Old answer:
This is now possible by using the new Visual Studio 2017 Tools for Azure Functions.
You can get more information about this in the following links:
Upvotes: -2
Reputation: 12538
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.
Upvotes: 10