Reputation: 75
Assume Http Trigger. When it is run from VS2019, VS2019 runs the command
C:\Users\<user>\AppData\Local\AzureFunctionsTools\Releases\1.10.0\cli\func.exe host start --port 7071 --pause-on-error
meaning the command does not provide any info about any Functions. VS2019 also runs the command
C:\Users\<user>\.nuget\packages\microsoft.net.sdk.functions\1.0.24\tools\net46\Microsoft.NET.Sdk.Functions.Generator.exe "....\bin\Debug\net461\bin\AzureFunction.dll " "....\bin\Debug\net461\ "
which obviously provides the info about the Function. The generator.exe seems to create the file function.json in the project folder. But how does func.exe know about it?
Upvotes: 0
Views: 1350
Reputation: 75
I played a little with func.exe directly, from developer command window, outside VS2019.
Firstly, func.exe uses the Environment's CurrentDirectory, so VS2019 has to set it explicitly before running func.exe
Secondly and most importantly, func.exe scans ALL subfolders from inside project's root where host.json is located, and looking for all the file(s) with name function.json. When VS2019 runs func.exe it sets the CurrentDirectory to path that already includes bin\Debug\net461, meaning func.exe does not look for any bin\Debug
The name fname where .../fname/function.json is found becomes the name of Function, e.g. here the Function name becomes "Function8" because func.exe runs from CurrentDirectory set to ...\bin\Debug\net461
...\bin\Debug\net461\Function8\function.json
here the function name also becomes "Function8" even there is no \bin\Debug\ as part of CurrentDirectory
...\Function8\function.json
There are also other factors like whether the Function is actually compiled as *.dll or provided as source code *.csx. All this is not documented and it should.
Upvotes: 1
Reputation: 14088
'func.exe
' is offered by Azure Function Core Tools. this will find whether there is a function.json in any folder under bin/Debug. If there are multiple functions under the folder, 'func.exe' will run all of them.(executing func.exe depends on function.json. If the function.json doesn't exist, Function will not run)
So 'func.exe
' cannot recognize a specific Function. The reason why 'func.exe
' seems recognize the specific Function in VS 2019 is that the func.exe
is looking for function.json
in the subfolder of bin/Debug when you use VS 2019 to run the Function and in the subfolder there is only one json file.
Upvotes: 0