问题描述
是否可以在 Azure Function Visual Studio 项目中引用 C# 类库?
Is it possible to reference a c# class library in an Azure Function visual studio project?
我知道引用外部库和 Nuget 包的可能性.目前我正在使用共享的 .csx 文件,如 这里.这些 .csx 文件现在包含我的 DTO 的副本,这些副本也用于我用来使用这些功能的服务代理中.
I am aware of the possibilities to reference external libraries and Nuget packages. Currently I am using shared .csx files as described here. These .csx files now contain a copy of my DTO's which are also used in the Service Agents which I use to consume the functions.
理想情况下,我想在 Visual Studio 中添加一个从函数到类库项目的引用,并且 Visual Studio 正在将此 dll 添加到 bin 文件夹中.
Ideally I want to add a reference in Visual Studio from a Function to a class library project and that Visual Studio is adding this dll to the bin folder.
推荐答案
目前不支持项目引用,但您可以将项目的输出(生成的程序集和可能的依赖项)复制到函数根目录下的文件夹中,然后您可以使用上面提到的外部库支持来利用它(例如 #r "..myassemblyfolderMyAssembly.dll"
)
Currently, project references are not supported, but you can have the output of your project (the resulting assembly and possible dependencies) copied onto a folder under your function's root, which you can then leverage using the external libraries support you've mentioned above (e.g. #r "..myassemblyfolderMyAssembly.dll"
)
如果可能,我建议就该功能请求打开一个问题,在此 上分享有关您的场景的更多信息存储库.这允许其他人支持这些请求并帮助团队优先考虑这项工作.
If possible, I'd suggest opening an issue with that feature request, sharing more about your scenario on this repository. This allows other people to upvote those requests and helps the team prioritize this work.
这篇关于在我的 Azure Function 中引用 c# 类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!