Azure Functions Core Tools (2.4.432) Function Runtime Version: 2.0.12332.0 - The system cannot find the file specified. Press any key to continue . . .

Azure Functions host quits with “The system cannot find the file specified”

This post was most recently updated on February 13th, 2020.

Reading Time: 2 minutes.

So, another interesting issue I ran into when developing Azure Functions locally. What an endless bag of funsies! 😁 This time, the issue was simple but infuriating – my Azure Functions host would just silently close when debugging: none of the breakpoints would be hit, no information would be logged anywhere.

Azure Functions Core Tools (2.4.432 Commit hash: 3371a87e0fce2aa35986c0de8e77d5d618163b91)Function Runtime Version: 2.0.12332.0The system cannot find the file specifiedPress any key to continue . . .

I first encountered this by the Azure Functions host just silently failing right after starting debugging. My earlier article about that is available here:

The underlying issue is shown when you start without debugging instead of simply debugging – i.e., if your keybindings are default, instead of F5 you hit Ctrl+F5.

With that, you’ll run into a window showing the error in red.

Azure Functions Core Tools (2.4.432) Function Runtime Version: 2.0.12332.0 - The system cannot find the file specified. Press any key to continue . . .
Azure Functions Core Tools (2.4.432) Function Runtime Version: 2.0.12332.0 – The system cannot find the file specified. Press any key to continue . . .

Okay – that’s a bit more clear now! But which file is it not finding? How to resolve the issue?

How to generate the certificate Azure Functions host is expecting to find?

The solution to this one was 2-fold.

In this particular solution, the Azure Functions host was started with custom command line parameters, due to some particular configuration requirements.

First of all, after a CLI update my functions host stopped working without a certificate. So I had to generate one:

$cert = New-SelfSignedCertificate -Subject localhost -DnsName localhost -FriendlyName "Functions Development" -KeyUsage DigitalSignature -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1")
Export-PfxCertificate -Cert $cert -FilePath certificate.pfx -Password (ConvertTo-SecureString -String password -Force -AsPlainText)

After this, the exported certificate.pfx had to be set to be copied to the output folder.

My certificate file (certificate.pfx) for development shown in Visual Studio's solution explorer.
My certificate file (certificate.pfx) for development shown in Visual Studio’s solution explorer.

For your reference, this is what the changes look like in version control:

What adding certificate.pfx file to your project in Visual Studio looks like in GitHub desktop.
What adding certificate.pfx file to your project in Visual Studio looks like in GitHub desktop.

And that’s it!

mm

Leave a Reply

avatar
5000
  Subscribe  
Notify of