Azure / Azure-Functions

1.11k stars 195 forks source link

Add support for authoring Azure Functions as .NET Core class library #805

Closed pscholtes closed 5 years ago

pscholtes commented 6 years ago

Add support to the "Azure Functions and Web Jobs Tools" extension within Visual Studio for authoring Azure Functions as a .NET Core class library. This issue is a spin off from a conversation started in #686 and is possibly, semi-related to #790.

When creating a new Azure Function app, you must select between the versions "v1 (.NET Framework)" or "v2 (.NET Standard)".

  1. If v1 is selected, you can target any version of the .NET Framework <= 4.6.1
  2. If v2 is selected, you can target any version of .NET Standard <= 2.0

Neither option allows the resulting Azure Function project to target .NET Core 2.x.

Scenario Given the following VS solution/project architecture for Company Xyz:

Problem When a project reference is added from Xyz.Functions to Xyz.Common Visual Studio generates a "project not compatible" build error as these two projects reference different frameworks (i.e. .NET Standard != .NET Core).

Reasoning In a "real word" enterprise-level application, it's a very realistic expectation for a developer to centralize the logic for a specific processing routine and want to leverage that code from an IActionResult in a MVC app and a [TestMethod] in a MSTest project. Continuing with that approach, AF should allow a developer to leverage their .NET Core code from a Trigger as well.

soninaren commented 5 years ago

@MisinformedDNA When you go through the new project dialog box, it checks for an update to CLI and templates. If there is an update VS will start fetching the update and you will see a message at the bottom of the dialog box saying something like "Making sure all templates are up to date..." . Once that process is finished the message will be replaced with "refresh" link that will would have update the text in the new project dialog box.

However if you don't wait for the update to finish and click OK. It will use the current latest template on disk and will keep updating the templates in background. So the next time you open the templates you would automatically have latest which in this case is ".Net Core"

paulbatum commented 5 years ago

We haven't seen any major issues with this change so I'm closing this issue.