I am using Visual Studio 2017 preview(2) to create Azure Function. The template generated for it is very different from what I get in Visual Studio 2015.
The Visual Studio 2017 template create a .cs file for function, and template structure looks like below :
All functions are created as individual .cs file and there are no run.csx, project.json or function.json files, due to which I am not able to specify function specific dependencies and settings
If we see the earlier template (see the image below) with Visual Studio 2015, it well represent the folders and files available on Azure Portal. It has functions in individual folder with all .json and .csx file. This folder structure helps in segregating files related to a particular function (which is not the case with VS 2017 template)
In VS 2017, I want to specify function specific dependencies and binding settings by adding project.json and function.json. Please let me know about the way to achieve this?
Add Azure Function ProjectOpen the Visual Studio and create a new project. Choose “Cloud” from the project template type list and then “Azure Functions” as the project type. Give a meaningful name to your project and click “OK”. To start with, choose Empty as a project type and click “OK” to create the project.
json file contains runtime-specific configurations and is in the root folder of the function app.
In the Access keys tab, below Security + networking, copy the Connection string of key1. In your project, open the local. settings. json file and set the value of the AzureWebJobsStorage key to the connection string you copied.
This is intended. Azure Functions team changed the way you develop and deploy Function Apps in Visual Studio 2017. Now, it's basically a compiled class library, with functions being static methods with proper attributes.
You should not be editing function.json
manually anymore; instead use WebJob SDK attributes. Packages management is done the normal .NET way via NuGet packages.
The "old way" still works from within Azure portal for quick prototyping and experiments, but Visual Studio won't support it anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With