Get Azure Functions 2 Preview Up And Running On OS X With C# Functions

** This is what I encountered as of April 16, 2018 so this may no longer be accurate. Also, note that this is for the preview version.

tl;dr

Finally after much frustration and a bit of luck, I got something working. In order to document my journey to running code, I needed to figure out where some dotnet project and item templates came from. These templates had been installed by VS Code when I opened one of my many attempts when it recommended them. I wasn’t paying attention, so I had to find out where they came from 🙂

Googling for ‘dotnet new “azureFunctionsProjectTemplates”‘ resulted in a single link.

That link contains the instructions on how to install the item and project templates as well as how to create, build and run a new project.

Once the templates are installed, the build and run portion looks like this

$ mkdir funexample
$ cd funexample/
$ dotnet new "Azure Functions" -n funexample
$ dotnet new HttpTrigger -n get
$ dotnet build
$ func start --script-root bin/Debug/netstandard2.0/

You might need to adjust the version of the Microsoft.NET.Sdk.Functions package reference in your csproj file to match whatever version of the SDK that you used to install the templates.

I had planned on writing out a much longer version of how I got things running, but I’m not.

I really wished that I knew what magic combination of keywords would get me to that link earlier today. Hopefully I’ve written the title of this post so that other folks can find this and then head over to that link 🙂

This entry was posted in Azure Functions, C#. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *