有没有一种方法可以从多个.NET项目中创建一个Azure Function应用程序,并具有所有这些函数中的所有功能? [英] Is there a way to have an Azure Function App created from multiple .NET projects and have all of the Functions from all of them?

查看:44
本文介绍了有没有一种方法可以从多个.NET项目中创建一个Azure Function应用程序,并具有所有这些函数中的所有功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个具有多个功能的Azure Function应用程序,它是使用.NET项目(名称:Project1)创建的.

We have an Azure Function App that has multiple Functions, and was created using .NET project (Name: Project1).

我们希望将来自不同.NET项目(名称:Project2)的新Azure功能添加到现有的Azure Function应用中,而不会覆盖从Project1部署的现有功能.当前,当我们从Project2部署Azure Function时,将删除Project1中的函数,Function App仅包含Project2函数.

We want to add a new Azure function from a different .NET project (Name: Project2) to the existing Azure Function App without overwriting the existing functions that were deployed from Project1. Currently when we deploy Azure Function from Project2 the functions from Project1 gets removed, the Function App contains only the Project2 functions.

我们使用Azure DevOps发布管道部署该功能,并且我们还尝试了从Visual Studio发布-两者的行为方式相同.

We deploy the function using the Azure DevOps release pipelines, and we have also tried publishing from Visual Studio - both behave the same way.

那么,有没有办法保留Project 1中的功能-拥有两个.NET Projects中的功能?

So, is there a way to retain the functions from Project 1 - have functions from both the .NET Projects?

推荐答案

据我所知,没有很好的解决方案来满足您的需求,但是有一种解决方案并不能很好地为您提供参考.

As far as I know, there's no good solution to your needs, but there is a solution which is not so good for your reference.

我已经在azure门户上创建了一个名为"huyrFirstFunapp"的功能应用程序,并且其中有一个功能"Function1".单击平台功能"->高级工具(Kudu)".

I have created an function app on azure portal named "huyrFirstFunapp" and there is a function "Function1" in it. Click "Platform features" --> "Advanced tools (Kudu)".

在"kudu"页面中,导航到调试控制台"->"CMD"->站点"->"wwwroot".您可以看到文件夹"Function1",一个"host.json",如果您导入了一些外部模块,则还可以看到一个"bin"文件夹".

In "kudu" page, navigate to "Debug console" --> "CMD" --> "site" --> "wwwroot". You can see the folder "Function1", a "host.json" and if you have imported some external module, you can also see a "bin" folder".

现在打开其中有另一个功能项目的Visual Studio.在这里,我有一个名为"hurySecondFunapp"的项目,其中有一个函数"Function2".

Now open the visual studio which there is another function project in it. Here I have a project named "hurySecondFunapp" and there is a function "Function2" in it.

右键单击"hurySecondFunapp",然后单击构建",将生成一个"bin"文件夹和一个"Function2"文件夹,您可以在以下截图所示的目录中找到它们.

Right click "hurySecondFunapp" and click "Build", it will generate a "bin" folder and a "Function2" folder, you can find them in the directory shown as below screenshot.

然后,我们需要将"Function2"文件夹从本地拖动到"kudu"页面(到我们导航至的"wwwroot"目录)."Function1"文件夹和"Function2"文件夹将共存于"wwwroot"目录中,然后我们需要合并两个"bin"文件夹.如果您的两个函数非常简单并且不使用任何其他模块,则只需将"hurySecondFunapp.dll"和"hurySecondFunapp.pdb"从本地的"bin"文件夹拖到"kudu"页面的"bin"文件夹(如下所示),然后azure门户中的功能应用程序将在其中显示两个功能.

Then we need to drag the "Function2" folder from local to "kudu" page(to "wwwroot" directory which we have navigated to). "Function1" folder and "Function2" folder will co-exist in the "wwwroot" directory, and then we need to merge the two "bin" folders. If your two functions are very simple and don't use any other modules, we just need to drag the "hurySecondFunapp.dll" and "hurySecondFunapp.pdb" from "bin" folder in local to "bin" folder in "kudu" page(shown as below), then the function app in azure portal will show two functions in it.

但是,如果您的两个功能很复杂并且使用许多模块或外部dll,则此解决方案将不是一个好方法.我们需要合并两个"bin"文件夹之间的差异,也许这会引起很多问题.因此,仅提供一种解决方案供您参考,我不确定它是否可以在您身边正常使用.

这篇关于有没有一种方法可以从多个.NET项目中创建一个Azure Function应用程序,并具有所有这些函数中的所有功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆