InteXX
InteXX

Reputation: 6367

VB.NET Azure Functions — what does the Microsoft.CSharp assembly do?

I've been able to publish and consume an Azure Function in pure VB.NET, with no C# wrapper class. (For the interested, the how-to can be found here.)

During publish, however, this warning is issued:

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'

Obviously, this occurs because I'm publishing from a VB.NET project and the assembly is never referenced/loaded there.

But the omission seems to have no effect on the functionality of the code. It runs fine and returns the expected result.

My question is this: what role does the assembly play in an Azure Function?

We find this on NuGet:

Provides support for compilation and code generation, including dynamic, using the C# language

Well and good, but we're not doing any of that here.

Since the function runs successfully, would I be correct in a guess that the assembly is required only as an interpreter for a C# Script Azure Function?

Basically I'm trying to assess whether I'm production-ready with this approach, despite the warning.

Upvotes: 0

Views: 1311

Answers (2)

Kyal Lanum
Kyal Lanum

Reputation: 36

This is because when publishing an Azure Function we look for every binary in an assembly, and some platforms can't evaluate certain assemblies (e.g. A VB.NET platform cannot evaluate a CSharp assembly).

This warning is logged as an FYI, but its nothing to be concerned about.

Here is a link to GitHub with an answer that confirms this: https://github.com/Azure/azure-functions-host/issues/4856#issuecomment-526183588

Upvotes: 1

Daniel A. White
Daniel A. White

Reputation: 190942

One of your dependencies might depend on it. You should include it.

Upvotes: 1

Related Questions