[英]Import Azure Function from portal into Visual Studio
I really like working with Azure functions in the portal but am starting to need some more tooling that I'm used to for committing to my git repo, easily adding assemblies, and just plain working in a more familiar environment. 我真的很喜欢在门户网站中使用Azure功能,但是我开始需要一些我以前用于提交我的git仓库的工具,轻松添加程序集,并且只是在更熟悉的环境中工作。
Is it possible to create your Azure function app and possibly the functions themselves in the portal and then move over to Visual Studio and import that function app as a project? 是否可以在门户中创建Azure功能应用程序以及可能的功能本身,然后转移到Visual Studio并将该功能应用程序作为项目导入? Or am I approaching this wrong?
或者我接近这个错误? I understand we can create straight from Visual Studio and then publish up to Azure and maybe that is the way we should be doing it in the first place.
我知道我们可以直接从Visual Studio创建,然后发布到Azure,也许这就是我们应该首先做的方式。
A few pieces you could do. 你可以做几件事。 You can start development in the portal and then download the app settings (connection strings, etc.) via the azure-function-core-tools with a CLI command like
func azure functionapp fetch-app-settings <appName>
- but that will just pull the settings into an existing local project. 您可以在门户中开始开发,然后通过azure-function-core-tools下载应用程序设置(连接字符串等),并使用CLI命令,如
func azure functionapp fetch-app-settings <appName>
- 但这只是将设置拉入现有的本地项目。
You could also go to the Platform Settings tab and open the App Service Editor which would let you download the workspace as pictured below. 您还可以转到“ 平台设置”选项卡并打开“ 应用程序服务编辑器” ,以便下载工作区,如下图所示。 That will download the function project into a folder you could check into source control and use with CI/CD.
这会将函数项目下载到一个文件夹中,您可以将其检入源代码控制并与CI / CD一起使用。
However one important note is the portal for C# projects use C# script files (.csx), and the Visual Studio tools for Functions create .NET assemblies (.dll), so if using C# you wouldn't be able to download the workspace and open it up in Visual Studio - you'd likely be better off just copy/pasting the code into a Visual Studio project. 然而,一个重要的注意事项是C#项目的门户使用C#脚本文件(.csx),而函数的Visual Studio工具创建.NET程序集(.dll),因此如果使用C#,您将无法下载工作区和在Visual Studio中打开它 - 您可能最好只将代码复制/粘贴到Visual Studio项目中。
Personally since the latest v3 update of VS 2017 I find starting in Visual Studio is even more convenient than the portal was for Function apps. 个人自从VS 2017的最新v3更新后,我发现从Visual Studio开始比功能应用程序的门户更方便。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.