tesseract icon indicating copy to clipboard operation
tesseract copied to clipboard

Tesseract NuGet package - non-standard folders breaks tools such as LINQPad

Open albahari opened this issue 5 years ago • 2 comments

In the Tesseract NuGet package, the native DLLs are in following folders:

\x64 \x86

Could they please be moved to the standard location? That is:

\runtimes\win-x64\native \runtimes\win-x86\native

This would enable Tesseract to work with tools such as LINQPad. (As it is, it can only work with MSBuild.)

Here's the documentation on naming folders in NuGet (jump to "Architecture-specific folders"): https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks.

And here's the complete list of RIDs: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

albahari avatar Sep 06 '19 00:09 albahari

Good idea, I didn't know about them. I'll have a look at updating tesseract in time for the next release.

charlesw avatar Oct 12 '19 08:10 charlesw

Added this method to my LINQPad queries to allow InteropDotNet to find the native assemblies within the temporary folder LINQpad creates upon query execution.

Note that I'm on Windows and am still a beginner so I can't verify if it will work for everyone.

static void CopyTessLibraries(string tessVersion, string platform)
    {
        var destFolder = Path.Combine(Environment.CurrentDirectory,platform);
    
        Directory.CreateDirectory(destFolder);
    
        var tessNugetFolder = new LINQPad.ObjectModel.NuGetReference("Tesseract")
                                    .GetPackageFolders()
                                    .First(folderName => folderName.Contains($@"Tesseract\{tessVersion}"));
    
        var platformFiles = Directory.GetFiles(Path.Combine(tessNugetFolder,platform));
        foreach (var file in platformFiles)
        {
            var fileInfo = new FileInfo(file);
            var destFile = Path.Combine(destFolder, fileInfo.Name);
            if (!File.Exists(destFile))
            {
                fileInfo.CopyTo(destFile, true);
            }
        }
    }

2020-12-19_13-38-36

ZinohJoe avatar Dec 19 '20 18:12 ZinohJoe