Attribute function in dependency project as entry point

Teng L 21 Reputation points

Hi, I'm using C# to write my Azure Functions. I found that the framework does not use the functions, which are attributed with [FunctionName] already, OUT of the start-up project. For example, I have ProjectA depending on ProjectB. ProjectA is the targeted starting up project and ProjectB is the dependency that has "function1" attributed with [FunctionName('function1')]. When I start ProjectA, the function1 doesn't get loaded.

Question: Is this the expected behavior? Is there any documents that show details about how the attributes would be looked up? Like only per current assembly, or all assemblies in current appDomain or so. Is there a way that we can register a dependency for that purpose? Thank you so much!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,633 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,611 Reputation points Microsoft Employee

    UPDATE: Apart from the below approach, while not documented yet. You can set the FunctionsInDependencies property in your csproj file. This was mentioned in this SO thread.


    Functions are loaded by reading function.json files. These are generated during compilation even for C# functions. I have attached one that I've generated by running a release build in a fresh function app

       dotnet build -c release  

    Here is the same for reference

         "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.31",  
         "configurationSource": "attributes",  
         "bindings": [  
             "type": "httpTrigger",  
             "methods": [  
             "authLevel": "function",  
             "name": "req"  
         "disabled": false,  
         "scriptFile": "../bin/funk-csharp.dll",  
         "entryPoint": "funk_csharp.HttpTrigger.Run"  

    A similar file with the appropriate scriptFile and entryPoint values should do the trick. Here is how the release folder structure looks like


    0 comments No comments