5
votes

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?

1
Please try removing all bin and obj folders under all projects, and deleting the .vs folder. You might want to close Visual Studio before you do so.rickvdbosch
I tried that already even clearingthe nuget cache to make sure something was not in a wrong state and it still does not generate the file... However, right after I built using VS2017 and it was telling me that AzureStorage could not be found so I did dotnet restore from the command line and I got back to the point where the function.json was not generated... not sure that helps though...Georges Legros
Does it help to remove Storage nuget package? function.json should be generated under a folder named by function name, not in bin directly...Mikhail Shilkov
Well actually it does and even more strange, I don;t actuelly need it at all... My code that communicates with Azure Storage seems to work even without the ref to the package... Is that expected behavior?Georges Legros

1 Answers

0
votes

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.