-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for authoring Azure Functions as .NET Core class library #805
Comments
Some of the discussion in this issue is relevant - it provides steps that can get a function app with target This is the error you'll get if you try this: It would be good to understand whether we expect to be able to get this working. I don't understand the details so I'm tagging @fabiocav. |
FYI, as mentioned in #836, AWS Lambda allows one to target netcoreapp2.0 (https://aws.amazon.com/blogs/developer/aws-lambda-net-core-2-0-support-released/). |
Hey @paulbatum, in #836 (comment) you mention that more "investigation" is required for this issue. I am just curious, but is this issue in active discovery/development on the MSFT side? Do you have any updates or roadmap for support? Thanks! |
We're not spending cycles on this at the moment but we intend to in the coming months. |
This issue is pretty much holding me from using Azure functions. Please spend cycles on this. Its keeping developers with existing .NET Core libraries on the WebJob side. |
Since this won't happen for a few months, at least, could your libraries target .NET Standard instead? If not, what is blocking that? |
Its too much impact compared to the worth of the improvement. Im not suddenly targeting my production libraries to .NET standard. Its a fundamental change which requires full application testing and staging. Not something I put on my sprint that easy. |
I'm seeing that with version 15.0.40617.0 of the AF extensions, you can pick either the v1 (.NET Framework) or the v2 (.NET Core) project template. When v2 is selected the resulting project still targets the .NET Standard framework. In tracking this issue I recall that this is more or less how the extensions worked when v2 was introduced (i.e. choose v2 (.NET Core), but the project targets Standard); however, this confusion of Core/Standard was first discussed in #686 with @soninaren where ultimately it was changed to read v2 (.NET Standard) in 15.0.40502.0. The 15.0.40617.0 release notes state that:
@paulbatum not trying to understate the nuances/complexities of this, but can you please provide any updates or insights related to the aforementioned changes? |
Hi @pscholtes, unfortunately I dont have much else to add right now. The VS tooling has been built and tested to use class libraries that target .NET Standard, and there are technical problems that need to be worked through to allow you to work with class libraries that target .NET Core. We want to investigate but its not sitting at the top of our list of must-fix issues so I have no progress to report at the moment. |
The situation described by pscholtes's "real-life application" is exactly what our company is facing. It would mean the world if the issue could be prioritized. We've been looking at the github issues for months now with no real update on this. |
I need Functions to target .NET Core as well. In my case, I have a .NET Core class library that utilizes I wanted to look for a UserVoice idea on this, and turns out one does exist and is actually marked as "Completed"! But alas, although the title says "Support for NET Core", it was completed with support for NET Standard :( |
|
This also a blocker for us. Would be nice to get this fixed in the near future! |
Please target .NET core so I can start using functions instead of workers. I have been waiting for months now. Thanks in advance! |
@keesdewit82 Why not use WebJobs? No one should have to use workers. ;) And conversions from WebJobs to Functions are more straightforward. |
@Tealons & @keesdewit82 Out of curiosity, what features of .NET Core are you using that prevents you from targeting .NET Standard? |
@MisinformedDNA I have an existing .NET core solution. Changing my libraries to .NET standard would be a major change and would require full application testing. Too much for too little. Btw, I meant WebJobs indeed, the one that runs in my App Service. |
@keesdewit82 @MisinformedDNA Exactly the same issue here with regard to the dependency. |
I am about to start developing a .NET Core class library, that I would like to use with ASP.NET Core websites and Azure Functions. Unfortunately, this creates problems because Azure functions only run with .Net Standard. I want to use .NET Core for performance reasons (this is important to me): including Span, Memory and the forth coming linker. |
@Securso We decided to not use Azure function, but to create an implementation with IHostedServices. Maybe that's also a good alternative for you... |
@Securso The System.Memory package has the Span types for the .NET Framework, .NET Core and .NET Standard. |
I will be doing a fair bit of text parsing in my application. |
Yup, I know exactly what you are talking about and those types were added to the System.Memory package for .NET Framework 4.5+ and .NET Core 2.0. It was Core 2.1 at first, but now you can use them anywhere. They've also made changes to RyuJIT to increase performance for all frameworks. |
@MisinformedDNA The new types were added in the package you are referring to but not the overloads on existing types, such as the one that @Securso mentioned (int.Parse) |
@paulbatum I'm confused about the recent GA announcement of v2 with regard to this issue. It says
Some of the documentation also uses .NET Core verbage, like
In fact, the only place I see .NET Standard referenced, is when the documentation calls out the target framework, all other places I've found reference .NET Core. So can we target .NET Core now or not? |
I agree that the first quote you pulled is a little bit misleading. Right now the VS tooling makes it easy to run on .NET core 2.1 but "using" implies a little more (such as being able to use APIs that only exist in .NET Core 2.1). I think there is no issue with the second quote you pulled though. When you write a V2 function its running on .NET Core 2.1. |
Hi folks, apologies that we had to delay this work item while we focused on V2 GA. The good news is that we'll be starting work on this next month. We expect to have manual steps that you can try by mid October, and our goal is to have all relevant template/tooling updates complete and deployed by the end of October. Tracking work items:
|
The Templates have not yet been updated, but to validate the new behavior, you can simply update the Please let us know if you run into issues with that flow (also let us know if it works for you, as it would be good to get validation :) ) |
is it valid to be targeting core for something like a function app which is compiled as a DLL?? My understanding's always been if the code has an entry point it should target Core (vs Standard) whereas libs (aka DLLs) should be built on Standard. |
@fabiocav Running with |
@shibayan does a simple build work for you? If not, can you share a build log with any errors you may find? @brandonh-msft targeting |
@fabiocav 👍 but I feel it's worth clarifying that the current .Net Standard DLL a Function App is built in to today would also be consumable by a .Net Core app |
@fabiocav Yes. I just created Azure Function v2 and HttpTrigger using template in Visual Studio and changed |
@pscholtes |
@brandonh-msft Most of the customers that I've talked to about this are targeting .NET Core because of the additional APIs that don't exist in .NET Standard. |
Yeah, I was able to repro that. While we investigate, can you change your project properties from |
Thanks! I can now be debugging from Visual Studio. |
Hey @brandonh-msft! I believe at the time of this issue the latest .NET Standard version was missing critical API support for my application (maaaybe EFCore?). I honestly don't have a ton of working knowledge or experience with .NET Standard, so I likely didn't explore that avenue. I think I had incorrectly assumed that Standard would eventually go away and everything would be Core... but it's looking like we'll have both options for the foreseeable future? I got the same "fatal error" prompt from VS2017 and the fix described by @fabiocav did the trick (though it's |
@pscholtes thanks for the update! I've corrected the typo above! :) |
@pscholtes fair enough, though even EFCore only takes .NetStandard as a dependency I fully empathize w/ the confusion between Core and Standard so I'm trying to understand if it's a messaging/education issue or if there's a legit reason to create a library based on Core that I'm missing. This said, I did some research and did find a list of the missing namespaces from Standard that are present in Core and was a bit surprised at what I found ( |
In addition to .NET APIs, we also have customers who wanted to use dependencies they were bringing in that only supported .NET Core, and investing in changing the target for those dependencies was impractical or impossible (e.g. they didn't own the dependency). This change unblocks those customers in Functions. |
@brandonh-msft it's mostly messaging/education for me... when I see ".NET Standard" my brain interprets that as something akin to like .NET CF on a Pocket PC. |
Just an update on how I fixed this run time error - [Updated Azure Functions Web Jobs Tools from 15.8 to 15.10]. |
An update to Azure Functions and Web Job Tools version 15.10.2046.0 fixed this error for me. I was at a previous version of 15.10 and still received the error. |
Folks, we released the tooling updates last week. The default experience for File -> New Project -> Azure Functions is now a .NET Core 2.1 class library. If you get the error in the screenshot in the post from @colbroth above, make sure you update to the latest version of the Azure Functions and Web Jobs Tools. Anyone tried it out? I'd like to close this issue but I was hoping to hear from a few of you on how well this is working before I do that :) |
Also I should note that while I was talking about and screenshotting VS, all of this is true for Visual Studio Code as well :) |
@paulbatum I just tried this but i immediately ran into issues getting the Startup class into the extensions.json file. The known workarounds (build target etc.) don't work with .netcore 2.1 |
@mayoatbm can you open a separate issue with the details of your problem (your startup setup, details on which assembly you're applying the attribute to, etc.?) |
@fabiocav Done. Thanks. |
When I tried creating a new project via "Recent project templates" on the On 15.10.2046.0 |
@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" |
We haven't seen any major issues with this change so I'm closing this issue. |
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)".
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:
Xyz.Common
.NET Core 2.x shared library leveraging EF Core and various 3rd party packagesXyz.Web
ASP.NET Core Web Application leveraging AspNetCore.All, EF Core, Controllers, etc.Xyz.Functions
v2 Azure Functions project with HTTP, timer, and queue triggersProblem
When a project reference is added from
Xyz.Functions
toXyz.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 aTrigger
as well.The text was updated successfully, but these errors were encountered: