在 azure 函数发布过程中包含 c/c++ 非托管代码 dll,使用 dllimport 使用 [英] include c/c++ unmanaged code dll, consumed using dllimport, in azure functions publish process

查看:23
本文介绍了在 azure 函数发布过程中包含 c/c++ 非托管代码 dll,使用 dllimport 使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 azure 函数发布过程中包含使用 v2 .net 核心兼容的 DllImportAttribute 语句使用的 c/c++ 非托管代码 dll?

How does one include in a c/c++ unmanaged code dll, consumed using v2 .net core compatible DllImportAttribute statements, in azure functions publish process?

我已通过 azure storage explorer 手动复制到功能应用程序存储帐户,确认它在云部署中有效文件共享 ||站点/wwwroot/bin 文件夹.

I've confirmed it works in cloud deployment by manually copying, via azure storage explorer, to functions app storage account | file shares | | site/wwwroot/bin folder.

问题是现在我无法找到将它包含在 vs17 中的方法 ||发布过程.

Issue is now I haven't been able to find way to have it included in vs17 | | Publish process.

在执行 vs17 之前尝试将 dll 放在 in$(Configuration) etcoreapp2.1in 文件夹中 ||发布但不会导致它被拾取.

Tried placing dll in in$(Configuration) etcoreapp2.1in folder before executing vs17 | | Publish but doesn't result in it being picked up.

推荐答案

在 VS 中,右键单击您的 Function 项目并 Edit <FunctionProjectName>.csproj.在下面添加项目以复制我们在本地发布或调试时需要的 dll.

In VS, right click on your Function project and Edit <FunctionProjectName>.csproj. Add items below to copy dlls we need when publishing or debugging locally.

  <!-- For publish -->
  <ItemGroup> 
    <None Include=" relative or absolute path to your dll, which is not in your project">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!-- If you have put dlls under your project root -->
  <ItemGroup>
    <None Update="YourDllName.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!-- For local debug -->
  <Target Name="CopyToBin" BeforeTargets="Build">
    <Copy SourceFiles="relative or absolute path to your dll" DestinationFolder="$(OutputPath)in" />
  </Target>

这篇关于在 azure 函数发布过程中包含 c/c++ 非托管代码 dll,使用 dllimport 使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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