Georges Legros
Georges Legros

Reputation: 2504

Azure function build not generating function.json

I have an azure function that was working perfectly this morning (was published on Azure). I had to add some logging functionality in Azure Storage and suddently I cannot run my function anymore. I have not tried to publish it as it does not run locally.

The symptom is that I get the following exception:

System.IO.FileNotFoundException: 'Could not find file 'C:\projects\MySuperFunction\MySuperFunction\bin\Debug\netstandard2.0\bin\function.json'.'

I read that thtis file is supposed to be generated at build time but I can confirm that the file is not there at all.

The only modifications I made to the project was to add a reference to the WindowsAzure.Storage nuget package (v9.2.0)

Does anyone knows why it is failing now while it was not before and, ideally, how to get it back working?

Upvotes: 7

Views: 4009

Answers (2)

RichyRoo
RichyRoo

Reputation: 420

For my situation at least this wasn't an irrecoverable exception and simply continuing with the debug session worked fine.

I turned off 'Break on Exception' for FileNotFoundException and it was all good :)

https://github.com/Azure/azure-functions-vs-build-sdk/issues/196

(I didn't have the WindowsAzure.Storage change in my project, so YMMV)

Upvotes: 1

Chris Gillum
Chris Gillum

Reputation: 15042

I'm not sure if this is the cause, but you should not be adding references to WindowsAzure.Storage since a specific version of that package is included by default when you reference Microsoft.Azure.WebJobs.

Trying to reference other versions of the storage library is known to cause compatibility issues since the Azure Functions runtime (and the CLI) has its own version of this library that is different from the one you're referencing in your project.

Upvotes: 0

Related Questions