ForNeVeR / tdlib.native

Prebuilt binaries of TDLib distributed as a NuGet package.
Boost Software License 1.0
103 stars 24 forks source link

No generation of .dlls when using NuGet package in C# #81

Closed lnx1-1 closed 1 year ago

lnx1-1 commented 1 year ago

Hey People :) first, a big thank you for your work on tdlib! I realy appreciate ist.

To the bug Itself:

When I build my project in which I installed the TDLib 1.8.9.1 and tdlib.native 1.8.9 the DLL are all missing in the output folder.

tdjson.dll zlib1.dll libssl-3-x64.dll libcrypto-3-x64.dll

If I copy the prebuild ones to the bin folder, everything works fine. But as far as I understood the purpose behind the tdlib.native is to provide prebuild dlls to be copied to the binary folder during build, right?

Setup informations I'm using Jetbrains Rider with multiple Class Library Projects. Machine: Windows 10 - 64bit ### Here is my Build Config: ![grafik](https://user-images.githubusercontent.com/59773698/219869960-b94fe914-3c4f-4a52-b451-a8125a2b4805.png) ### csproj ~~~ 9 netstandard2.0 Debug;Release;Debug x64 AnyCPU;x64 true false Always ~~~ ## Assembly View ![grafik](https://user-images.githubusercontent.com/59773698/219870286-e39f3279-d999-4965-881d-028c257e1367.png)
ForNeVeR commented 1 year ago

But as far as I understood the purpose behind the tdlib.native is to provide prebuild dlls to be copied to the binary folder during build, right?

Not that simple.

tdlib.native provides native libraries in a way they'll be picked up by the .NET runtime loader, among other things. This doesn't technically require them to be copied on build.

In this case, you have a .NET Standard library that is not directly runnable; that's why no binraies is even possible to copy to its output: there are no compatible runtimes defined in it.

Try doing the same with a .NET executable (not a library!), and you'll see the difference in the output behavior.

I think that if you create an executable (on .NET 6 or 7, for example) depending on your .NET Standard project, then the binaries will be properly copied on build (or, better, on dotnet publish).

lnx1-1 commented 1 year ago

Okay, I understand :) I was wondering because I have a second NuGet package OpenTAP where exactly this is happening. I'm building a class library for Netstandard and all files are copied by the plugin on Build.

But i see that this isn't the way this package is meant to work. So I will just let it copy another way automaticly.

Thank you for the quick answer and explanation!!

ForNeVeR commented 1 year ago

OpenTAP works in another way (with custom .nuspec and different file layout), so I guess they have different goals.