How to deploy runtime files to a subfolder in a .NET Framework project #210
-
|
I need to be able to deploy the runtime files to a subfolder (runtimes\win-x64\native would be fine) for my .NET framework project, but the files are always output to the same folder as the main project assembly. How can I achieve this, it looks like it is possible, but I'm not sure how? If I try to manually move them to "runtimes\win-x64\native" then the configuration/initialisation does not work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
For .NET Framework projects the behavior is expected: native GDAL binaries from the Windows runtime package are copied to the application output folder. The You have two options:
using MaxRev.Gdal.Core;
GdalBase.ConfigureAll();
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
var nativePath = Path.Combine(baseDir, "runtimes", "win-x64", "native");
Environment.SetEnvironmentVariable("PATH", nativePath + ";" + Environment.GetEnvironmentVariable("PATH"));
GdalBase.ConfigureAll();You would have to disable restore of this package or remove it completely from the project and configure static reference of DLLs. You may have to relocate |
Beta Was this translation helpful? Give feedback.
For .NET Framework projects the behavior is expected: native GDAL binaries from the Windows runtime package are copied to the application output folder. The
runtimes\win-x64\nativelayout only works automatically in SDK-style projects with publish-time RID resolution (i.e., .NET Core or SDK-style .NET Framework).You have two options:
runtimes\win-x64\native: move only the native DLLs there and add that folder to the DLL search path before any GDAL calls: