Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.94k stars 442 forks source link

Packaging a dotnet Function in library and reference the library with dotnet-isolated - GenerateFunctionMetadata #8447

Open SPSCS-Simon opened 2 years ago

SPSCS-Simon commented 2 years ago

In a scenario where we have different team developing different functions and they can develop/test locally an be able to package each functioning a library/assembly (possibly pushed to a local nugget repository).

The plan would be to:

  1. separate put the functions from the Startup/Program where the function is in the library that is referenced by another project with the Startup/Program.
  2. to take those function libraries, and reference them in another project that contains all the functions such that that can then dev deployed to an Azure Function App Service that host all the functions.

The documents on Function Class Library Project - assume one has a single project but that is really going to work in our environment.

It seem with adding the complexity of dotnet-isolated this is more complex to set up, given how the function.json is dynamically generated its can I seem to get he following error

Microsoft.Azure.Functions.Worker.Sdk.targets(60, 5): [MSB4062] The "GenerateFunctionMetadata" task could not be loaded from the assembly /Users/<user>/.nuget/packages/microsoft.net.sdk.functions/4.0.1/build/../tools/net6.0/Microsoft.NET.Sdk.Functions.MSBuild.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Is there any way to get this to work? or is this an enhancement?

bopcheshailesh commented 2 years ago

In a scenario where we have different team developing different functions and they can develop/test locally an be able to package each functioning a library/assembly (possibly pushed to a local nugget repository).

The plan would be to:

  1. separate put the functions from the Startup/Program where the function is in the library that is referenced by another project with the Startup/Program.
  2. to take those function libraries, and reference them in another project that contains all the functions such that that can then dev deployed to an Azure Function App Service that host all the functions.

The documents on Function Class Library Project - assume one has a single project but that is really going to work in our environment.

It seem with adding the complexity of dotnet-isolated this is more complex to set up, given how the function.json is dynamically generated its can I seem to get he following error

Microsoft.Azure.Functions.Worker.Sdk.targets(60, 5): [MSB4062] The "GenerateFunctionMetadata" task could not be loaded from the assembly /Users/<user>/.nuget/packages/microsoft.net.sdk.functions/4.0.1/build/../tools/net6.0/Microsoft.NET.Sdk.Functions.MSBuild.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Is there any way to get this to work? or is this an enhancement?

Facing same issue

TheMidgardWatcher commented 1 year ago

Is there any update on this topic? In my dotnet 7 isolated project I also want to store functions in separate class library referenced by startup Azure Functions Application project. Is there any possibility to have such a setup?