Adding Libspotify SDK to a .NET solution - c#

I'm trying to add the Libspotify SDK to a test solution. However, I got the following error:
Now, I tried following the first answer of this question. However, all I got was:
The package of the library is structured in the following way:
Additionaly, my project is targeted to .NET Framework 4.0
And the configuration is done as follows:
What can I do to add this library?
EDIT:
Also, I found this link where someone explains that it need to be copied manually into the project output directory. I tried putting the .dll there, but I guess I have to modify something else to make it work. Any ideas?

The libspotify.dll you are trying to access is a Win32 C library, not a C# (.NET) assembly. As such, you can only use it through interop.
You don't have to do this yourself (judging by your question I'm assuming you have no previous experience with the techniques involved), you can use a ready-made solution like libspotify.NET.

Related

How to find out which dependency is missing after DllNotFoundException?

I want to write a small .Net MAUI application which makes use of a C# SDK NuGet Package (implementing Hyperledger Anoncreds).
When running the App on Android (emulator or device) most of the SDK method calls work, but certain calls still throw a DllNotFoundException without any indication of which Dll is actually missing.
After I did some reading on the SDK, I was able to add some .so dependencies to the MAUI project, but apparently there are still some missing.
I already tried reading through the SDK source code and some of the Rust code it wraps to get hunch of what could possibly be missing. But even wading through the cargo.toml files only show me the crates and not any actually libraries.
Android tools like "APK Analyzer" provide a lot of usefull information, but no dependency overview and the "Dependency Walker" tool only analyzes Windows-built binaries which differs from the actual Android environment.
How do I find the missing dependency indicated by the Exception? Is there a tool like "Dependency Walker" for Android APKs?
Edit: Fixed some typos and added more Info.
After a quick google search for an equivalent of ldd on Android I found this:
ndk-depends which should be shipped with Android NDK. I would try and use that on the .so files that you use and include with your project.
EDIT: Here is a link to the manual: ndk-depends
Hope it helps!

Can i make a clean exe without dll files ? in C#

hi , i have a question
Can i import this dll files in the program itself in C# ?
Note : the program will not open without them !
Yes. Net 6 supports this, it's called a SingleFileApplication. see https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file
What you’re referring to is called static linking. As others have mentioned .NET 6 has a concept of a “single file application” that can handle this for you. If you’re using .NET Framework then things get a little more challenging as there’s no out of the box mechanism to do this. Fortunately there are techniques that can make this work — from bundling the library DLLs as resources and extracting them on the fly or using a tool like ilmerge. This is covered in depth here: Static Linking of libraries created on C# .NET

Roslyn with .NET core on linux: How can I load an external project?

First of all, I don't know much about Roslyn. I went through a few tutorials hot to generate code and how to parse a string containing code.
So far, everything is clear to me.
Here is my question:
I'm using dotnet core 1.0.1 on Linux.
I created a new project with some interfaces defining some properties.
What I want to do is to create a program in which I can load the project, run trough the interfaces (*.cs files) and generate some code.
My problem is, I don't know how to load/open a c# project with Roslyn.
The tutorials I found are using a windows environment. These samples doesn't work on my environment because there are some dependencies to MSBuild or Visual Studio. I read and tried some things about the AdhocWorkspace, but I didn't manage to open an existing solution this way.
Can anyone give me a hint how to start?
Is it possible to open/load a project (*.csproj) and run through all *.cs-files?
Thanks in advance.
Currently, there is no good way to open .Net projects using Roslyn on .Net Core.
See this issue on the Roslyn repo, where the recommended solution is to use code from the Omnisharp project.

Can't find reference Microsoft.DirectX.AudioVideoPlayback

I have some problems with the references. But first let me clear the
circumstances. I use Win7, VS 2010, .NET Framework 3.5.
I have a project previously worked on by a colleague.
Now I have the project for some further changes and the programm does not find the Microsoft.DirectX.AudioVideoPlayback reference.
I have tried adding to manually but I do not find it in the given path.
Does anyone have another solution, which provides me the right way?
That seems to be a reference to the Microsoft DirectX SDK. You would have to download and install that first via Microsoft's website, then the DLL-files can be found in %SystemRoot%\Microsoft.NET\DirectX for Managed Code\1.0.2902.0.

How to get source code of .NET libraries to VS

I was told that Microsoft has released reference source code for some .NET libraries (I'm especially interested in C# libraries). If it is true, I would like to download that code and use it with my VS, so I can browse the code by selecting
Go to Declaration
and
Go to Implementation
from context menu. It would be much better then just to see documentation in object browser.
So how do I get VS to work with it? Thank you.
Up-to-Date answer
All you need is this: http://referencesource.microsoft.com/
Here's an article on MSDN and you may also checkout the following article and this blog post also. This allows you to step through the framework source code while debugging your applications. Reflector is also a good tool for browsing through the compiled assemblies.
Here is reference source code for.NET from Microsoft that available for download.
Here is how to set up VS for debuging.
Darin said nearly everything. The only hint that is missing is the NetMassDownloader to get the whole source once if needed.
here you go: .net source code download link
good luck in compiling it so you can debug through it like it was one of your own projects. I don't know how big a project you've ever worked on, but this one's a big one and its not as simple as you would imagine...
The .net core, .net 5 and .net 6 runtime code can be found here:
https://github.com/dotnet/runtime
This repo contains the code to build the .NET runtime, libraries and shared host (dotnet) installers for all supported platforms, as well as the sources to .NET runtime and libraries.

Categories

Resources