couchbase-lite-net icon indicating copy to clipboard operation
couchbase-lite-net copied to clipboard

(3.2.0) LiteCore.dll not copied to correct folders when building with SelfContained

Open Wyvernius opened this issue 1 year ago • 5 comments

Library Version

3.2.0

.NET Runtime

net8.0-Windows net8.0

Log Output

DllNotFoundException: Could not find LiteCore.dll! Nothing is going to work! Tried searching in: C:\Users\Vince\source\repos\CouchbaseLiteBuild\bin\Debug\net8.0\win-x64\runtimes\win-x64\native\LiteCore.dll C:\Users\Vince\source\repos\CouchbaseLiteBuild\bin\Debug\net8.0\win-x64\x64\LiteCore.dll C:\Users\Vince\source\repos\CouchbaseLiteBuild\bin\Debug\net8.0\win-x64\bin\x64\LiteCore.dll

Expected behavior

LiteCore.dll is copied to output in the folders: x64 and arm64

Actual behavior

LiteCore.dll is not copied to the folders specified above.

Steps To Reproduce

  1. Create new console application
  2. Reference latest CouchbaseLite nuget package
  3. Set SelfContained = true in .csproj

Note:

With 3.1.7 LiteCore.dll is copied to buildoutput/, buildoutput/x64, buildoutput/arm64 With 3.2.0 LiteCore.dll is copied to buildoutput/

Wyvernius avatar Sep 07 '24 09:09 Wyvernius

@borrrden

Wyvernius avatar Sep 09 '24 21:09 Wyvernius

By self contained, this means compiled to run without the .NET runtime on a single architecture right? I think rather than copy the files again the correct solution would be to add an additional lookup directory being buildoutput after x64 and arm64 are considered because the only reason they exist is because .NET can run on multiple architectures and you don't know which one until after you are already running.

borrrden avatar Sep 09 '24 22:09 borrrden

Otherwise if it still needs to run on multiple architectures, then I'm not quite sure what the strategy is supposed to be because it's a waste to copy them otherwise.

borrrden avatar Sep 09 '24 22:09 borrrden

Ok doing a quick test I see that my former assumption is correct and self contained implies one runtime architecture to target. This will be a simple fix I believe. Tracking in CBL-6236

borrrden avatar Sep 10 '24 01:09 borrrden

In the meantime, you probably have already realized this but you can workaround this by adding a postbuild step to move the buildoutput/LiteCore.dll file to buildoutput/<arch>/LiteCore.dll

borrrden avatar Sep 10 '24 01:09 borrrden

3.2.1 is released which should have a fix for this.

borrrden avatar Nov 19 '24 22:11 borrrden