No job functions found. Try making your job classes and methods public

大城市里の小女人 提交于 2019-11-30 23:04:38
Mikhail Shilkov

You should upgrade to the latest Microsoft.NET.Sdk.Functions (1.0.6 as of today) and Microsoft.Azure.WebJobs.Service.Bus (2.1.0-beta4 if running on full framework). You might need to remove the ServiceBus reference first in order to upgrade SDK.

The Microsoft.Azure.Eventhubs package also needs to be removed. All relevant types etc are in Microsoft.Azure.WebJobs.Service.Bus

Also remember to check "Include prerelease" in the package manager in order to find 2.1.0-beta4.

Another gotcha I found especially if you are converting from another project or version.

In the VS csproj file, make sure AzureFunctionsVersion is present

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
...etc

the tooling adds this automatically but not added if you are modifying a project where this was missing. Hope this helps you save the 3 hours it cost me :-).

If you debug/run from Visual Studio (F5), somehow, even with latest Microsoft.NET.Sdk.Functions (v1.0.28), its not able to detect AzureFunctions defined in the project.

I root caused the issue to Project properties > Debug > Working Directory is not set somehow by default. Set it to the actual directory where binaries are found and your AzureFunctions becomes available for debug.

PS, this would add launchSettings.json /profiles/{projectName}/workingDirectory=/objd/amd64/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!