Paul Dolphin
Paul Dolphin

Reputation: 798

Trying to run an Azure Function App locally from Visual Studio 2017 gives a 'func.exe does not exist' error

I have created a new Azure Function app with an Http Trigger in Visual Studio 2017 (which I have just updated to v15.8.4). Using the generated function, when I try to run it I just get a message box with the error

The debug executable "C:\Users\Paul\AppData\Local\AzureFunctionTools\Releases\2.5.2\cli\func.exe" specified in the 'FunctionApp1' debug profile does not exist.

Sure enough there is no func.exe at that location, just a func.dll.

The file C:\Users\Paul\AppData\Local\AzureFunctionTools\Releases\1.3.0\cli\func.exe does exist.

I have successfully run an Azure function locally before but I assume updating Visual Studio a few times has broken something. How can I get this working?

Upvotes: 8

Views: 21508

Answers (7)

Rohit Majji
Rohit Majji

Reputation: 191

I Deleted AzureFunctionsTools and azure-functions-core-tools from C:\Users\ {YourUser} \AppData\Local. And ran the solution again it downloaded the same tools and then executed without errors.

Upvotes: 18

Iman
Iman

Reputation: 18946

In my similar case after installing Visual studio 2019 16.11.2 in a new Win 10 S.

  • I had already AzureFunctionsTools version 3.23.5 installed with func.exe inside the cli folder (without_x64 suffix)
  • But my newly installed VS 2019 was looking for func.exe in a similar path with only one difference that was (_x64 suffix after cli).
C:\Users\[username]\AppData\Local\AzureFunctionsTools\Releases\3.23.5\cli_x64
  • After getting no result trying a other solutions mentioned here I finally renamed the existing cli folder to cli_X64 and it worked

Upvotes: 3

Pranav Singh
Pranav Singh

Reputation: 20141

What worked for me is combination of above two answers .

Same error I also faced due to anti-virus but can't modify anti-virus since it can be changed by IT Security/networking team and process is time-taking & long process. Another workaround is :

  1. Install azure-functions-core-tools via npm

    npm install -g azure-functions-core-tools@3

  2. Change Executable & Working Directory in Debug settings for azure Project settings

Working Directory : C:\<Project path>\bin\Debug\netcoreapp3.1

Executable : C:\Users\<username>\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe

enter image description here

Upvotes: 0

andytham
andytham

Reputation: 571

I was just having on a fresh install of Visual Studio 2019 (had to uninstall 2017), and it was irritating me to no end.

I have found a solution to the problem, but no reason as to why this problem happened nor why Visual Studio deemed it necessary to make it so hard to fix things (they have no option of installing or reinstalling Azure Functions Tools in VS 2019 or even outside of it).

Solution:

Find a way to download the release. I used npm: npm install -g azure-functions-core-tools@3 (-g is global but you can install it locally, @3 will install the latest 3.x.x)

Replace the entire contents of C:\Users\<username>\AppData\Local\AzureFunctionsTools\Releases\3.4.1\cli_x64 with the version you installed.

For me, it was all the files in \node_modules\azure-functions-core-tools\bin.

Upvotes: 0

Kalyan Chanumolu-MSFT
Kalyan Chanumolu-MSFT

Reputation: 1143

I am able to get this working just by targeting .Net Standard 2.0.

Just change to netstandard2.0 in the project file.

Application Settings

enter image description here

Debug Settings

enter image description here

There is no need of providing a path to the func.dll.

Upvotes: 2

Tom Sun
Tom Sun

Reputation: 24549

How can I get this working?

In your case, it seems that there is no azure function tools v2 , please have a try to install it.

npm i -g azure-functions-core-tools@core --unsafe-perm true

Please also try to update the [Azure functions and Web Jobs tools] to latest version

tool->Extensions and updates

enter image description here

And then try to run the azure function, if there is no corrosponding version it will download it automatically.

enter image description here

Test Result

enter image description here

Update

Check the function tools from the path

C:\Users\{userName}\AppData\Local\AzureFunctionsTools\Releases

enter image description here

Upvotes: 2

Paul Dolphin
Paul Dolphin

Reputation: 798

I eventually got this to work by changing the settings in the Debug screen.

I changed Launch from Project to Executable

I set Executable to C:\Users\xxxx\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe

I changed Application arguments to start

I changed Working Directory to Sourcedirectory\FunctionApp1\FunctionApp1\bin\Debug\netstandard2.0

I would still love to know where the Project settings were getting their values from though...

Debug Settings

Upvotes: 9

Related Questions