Search code examples
azurevisual-studio-2017azure-webjobsazure-functions

Azure function returns error: No job functions found. Try making your job classes and methods public


I have created an Azure Function application in Visual Studio 2017 and can publish it to Azure without any issues using the Visual Studio publish functionality (right click project then select Publish).

As deploying from a developers instance of Visual Studio isn't an ideal continuous integration strategy, I have created a deployment pipeline with TeamCity and Octopus where TeamCity builds the Azure function application and Octopus uses the WAWSDeploy application to deploy the Azure Function files to Azure. The deployment works fine and I when I view the Azure function files when deployed via WAWSDeploy, the files are exactly the same as when I publish the Azure Function application from Visual Studio.

However I get the errors No job functions found. Try making your job classes and methods public. and Invalid script file name configuration. The 'scriptFile' property is set to a file that does not exist. when I deploy (by viewing the Azure Function application logs) from WAWSDeploy. This doesn't appear to be a WAWSDeploy issue but it looks like the Visual Studio publish function is doing something I'm missing. Any ideas?

Folder structure of Azure function files:

enter image description here


Solution

  • Issue was caused by having an incorrect scriptFile value in the function.json file. When I published the Azure function from Visual Studio, this value is set correctly but when I build the Azure function and push the files to the Azure function application manually, the scriptFile value is missing the bin folder in the path to my function dll file. During my build process, I now hack the scriptFile value to set it correctly.