1
votes

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

3
Can you share your folder structure (with the location of your function assembly) and the value you have in the scriptFile property?Fabio Cavalcante
@FabioCavalcante I have edited my question to include my function file structure. I am unable to find the scriptFile property and have not set/updated it previously. Where can I find it?dhughes
scriptFile should be a property in the function.json file.brettsam
Thanks @brettsam - you have help me solve the problem I think. When I publish the Azure function, the scriptFile value is ..\\bin\\myFunction.dll but when I build then deploy, the scriptFile value is ..\\myFunction.dll. @FabioCavalcante - why do publish and build generate different scriptFile values?dhughes
I can confirm this resolves the issue. I have made a hack in my Powershell script to set the correct scriptFile value.dhughes

3 Answers

1
votes

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.

0
votes

I faced similar issues and finally managed to found the root cause. You may fixed this problem, but putting this here for anyone else facing this problem.

Ensure you have this following block of element in your .csproj in of a Function App

<None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

I got this problem when i excluded host.json from the project and then created one again (after realizing this is needed for sure).

valid .csproj should look something like this

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>

  ...
  ...
  ...

  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Hopefully Adding that will solve this issue. Let me know if this helps :)

0
votes

I faced the same issue,

I deleted the bin and obj folders and rebuilt the project and it works perfectly then.