You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have a .netstandard2 project that references consumes MaxRev.Gdal.Core and MaxRev.Gdal.WindowsRuntime.Minimal through Nuget (Let's call this ClassLibrary1). This project is built into a nuget package and consumed by a .Net Framework 4.7.2 console app (Let's call this ConsoleApp2) . When running the GdalBase.ConfigureAll() function, I get an error: Unable to load DLL 'gdal_wrap'. The specified module could not be found.
Viewing the bin of ConsoleApp2, I can verify that gdal_wrap.dll is there in the runtimes folder:
ConsoleApp2\bin\Debug\runtimes\win-x64\native\gdal_wrap.dll
ClassLibrary1 (.netstandard2):
using System;
using MaxRev.Gdal.Core;
namespace ClassLibrary1
{
public static class Class1
{
static Class1()
{
GdalBase.ConfigureAll();
}
public static int NumberFunction()
{
return 1;
}
}
}
ConsoleApp2 (.Net Framework 4.7.2):
using System;
using ClassLibrary1;
namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting");
if (Class1.NumberFunction() == 1)
{
Console.WriteLine("Success");
}
}
}
}
Is this the expected behavior due to the .NET framework and .NET standard capability? Is there any way to use MaxRev.Gdal.Core in .NET Framework 4.7.2?
Environment information:
OS: Windows 10
Package version (core): MaxRev.Gdal.Core 3.8.3.286
Package version (runtime): MaxRev.Gdal.WindowsRuntime.Minimal 3.8.3.259
Additional context
This is just example code to reproduce and illustrate the problem found in a larger application.
The text was updated successfully, but these errors were encountered:
@Jonhops1595 thanks for creating this issue. I can confirm that it requires packaging some additional build target files specific to NetFramework in order to copy files during the build to the output directory.
For now, as a workaround, you can create a similar file within your library project. I'll include it in the next release.
Another solution is to switch to net480 and csproj and package reference instead of packages.config. I had successfully loaded GDAL in net480 adding Nuget packages via PackageReference.
MaxRev-Dev
changed the title
[BUG] Unable to load DLL 'gdal_wrap'. The specified module could not be found.
[BUG] Native files are not being copied to the output directory in NetFramework
Apr 19, 2024
Thank you @MaxRev-Dev. Using PackageReference worked for the demo project. I am now working on implementing this in the larger application. I'll comment when I get that working as well.
Describe the bug
I have a .netstandard2 project that references consumes MaxRev.Gdal.Core and MaxRev.Gdal.WindowsRuntime.Minimal through Nuget (Let's call this ClassLibrary1). This project is built into a nuget package and consumed by a .Net Framework 4.7.2 console app (Let's call this ConsoleApp2) . When running the GdalBase.ConfigureAll() function, I get an error: Unable to load DLL 'gdal_wrap'. The specified module could not be found.
Viewing the bin of ConsoleApp2, I can verify that gdal_wrap.dll is there in the runtimes folder:
ConsoleApp2\bin\Debug\runtimes\win-x64\native\gdal_wrap.dll
ClassLibrary1 (.netstandard2):
ConsoleApp2 (.Net Framework 4.7.2):
Is this the expected behavior due to the .NET framework and .NET standard capability? Is there any way to use MaxRev.Gdal.Core in .NET Framework 4.7.2?
Environment information:
Additional context
This is just example code to reproduce and illustrate the problem found in a larger application.
The text was updated successfully, but these errors were encountered: