VB.NET in Azure Functions
FYI I was able to get a pure-VB.NET Azure Function working. It was pretty simple, really—here's what I did:
-
Created a C# sample using this guidance
-
Created a new VB.NET project (in .NET Standard 2.0 instead of .NET Core 2.2—I ran into missing dependency problems while trying it in Core)
-
Converted the C# sample class using Telerik's Code Converter
-
Added the converted code to the VB.NET project (being careful to remove the redundant namespace declaration)
-
Per this advice, added the
AzureFunctionsVersionelement to the VB.NET project's XML:<PropertyGroup> <RootNamespace>FunctionApp1</RootNamespace> <TargetFramework>netstandard2.0</TargetFramework> <AzureFunctionsVersion>v2</AzureFunctionsVersion> </PropertyGroup> -
Published and tested as normal
If you're using WebDeploy (uncheck the 'Run from package file' checkbox at first publish), you'll see a warning during deployment:
Could not evaluate 'Microsoft.CSharp.dll' for extension metadata. Exception message: Could not load file or assembly 'Microsoft.CSharp, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
This warning can be safely ignored. Best guess, the assembly is probably only necessary as an interpreter for C# Script functions.
Due to my limited bandwidth I can only publish via WebDeploy, so I'm not aware of whether the warning occurs during a ZipDeploy (checking the Package checkbox).
And there we have it—an Azure Function in pure VB.NET.
Does the local debugger and such work?
Yes.
No that I expect it to change but have your tested with azure function be (and .net core 3.1?)
I haven't.
No that I expect it to change but have your tested with azure function be (and .net core 3.1?)
Perhaps I did not clearly understand what @aarondglover asks, but I'm converted full C# based azure function into full VB.NET with .NET Core 3.1 and test it, deploy it in App Service also.
I meant to say "Azure Function 3.0 (and .NET Core 3.1)"
@InteXX or @rrvenki
Can either of you please publish an empty/sample project to GitHub which I can clone to get started?
@aarondglover
Did you run into problems with the steps above? They may be in need of revision if so.
@aarondglover
How did you fare with this? Were you able to get it working?
@aarondglover if you require a simple sample Azure functions project in VB I can share it.
@rrvenki
Thank you, yes please.
ahh.. Finally... I've ended up using a different approach. Here's my result:
2020-05-08T18:45:40.538 [Info] Function started (Id=XXXXXXXX-XXXX-XXXX-XXXX-cbc5XXXXX7)
2020-05-08T18:45:40.538 [Info] VB 64bit (Framework 4.8) HTTP trigger function processed a request.
2020-05-08T18:45:40.538 [Info] Function completed (Success, Id=XXXXXXXX-XXXX-XXXX-XXXX-cbc5XXXXX7, Duration=10ms)
@SilverfoxSystems
Could you provide some more detail?
I've created a new function in VS2019 and there I've examined the "MS.NET.Sdk.Functions" package. Using VS2015, I created a Class Library and manually imported each package from the mentioned package. Converted the VS2019 C# code into VB and so on... Further details (and maybe a step-by-step procedure) will be available on my website.
I found this:
http://silverfox.systems/
Will you be publishing something there?
Yes, that's it. I will notify you here when it will be ready.
@SilverfoxSystems
Sounds good, thanks. I'm looking forward to it.
There we go:
http://silverfox.systems/Azure_VB_Function.aspx
The page still needs a bit of styling, but it'll do for now... You're welcome.
@SilverfoxSystems
Looks good, I like it!
I think I'm going to work up a template based on this. With your permission, of course.
@InteXX Sure, go ahead... I'm considering automating the whole process myself.
Oh man, thanks for the donation there! Fair play to you, it's really gonna help me out in my current situation.
I think I'm going to work up a template based on this.
Why should C# coders have it any more comfortable anyway :)
I've added a repo, if someone's interested...
Watched and starred. I'll fork it in the next few days. Thanks
Watched and starred. I'll fork it in the next few days. Thanks
Good man! You're welcome.
for as much as I would be interested, I'm not even considering an ecosystem that carries along 49 (fortynine) dlls for a hello world proof of concept. A 12kb executable carries along 23MB of libraries and descriptors. Thanks, but no thanks.
@Padanian
That's Azure Functions for you ;-)
@Padanian That is only if you don't use Pack, with Core 5.0 the total app of Hello World size is 155KB on Windows.
@InteXX never mind it is smaller but not that small. The feature is PublishTrimmed