最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

visual studio 2022 - GDAL Native DLL's not copied with dotnet publish - Stack Overflow

programmeradmin1浏览0评论

I'm working with GDAL to get the ElevationMap of GeoTIFF files in an .NET6 / Visual Studio 2022 environment.

In the Debug or Release everything works fine (there is a ./gdal subfolder in the bin-folder).

When I publish the application with dotnet publish, the ./gdal subfolder doesn't exist in the publish-folder. So the native gdal DLL's can't be found.

How do I get the gdal-subfolder to be copied to the publish-folder as well?

I use this command:

dotnet publish -c Release -r win-x64 --self-contained true --output C:\publish MySolution.sln

I tried to reference the GDAL.Native package in the startup project too, but it didn't help.

Update: I finally solved the problem by this code in the project file:

  <Target Name="PublishGDAL" AfterTargets="Publish">
     <Exec Command="move $(OutputPath)\gdal $(PublishDir)" />
  </Target>
发布评论

评论列表(0)

  1. 暂无评论