VB.NET DLL not possible in a Xamarin.Forms app? - vb.net

I'm trying to reference a VB.NET DLL in a Xamarin.Forms (Portable) application. During the course of my research, I found the following post that might allow this: Xamarin.Android and VB.Net Libraries
I've tried to use the "Embed" work-around mentioned in the link, but the Xamarin.Forms project would fail to build because it can't load the Microsoft.VisualBasic assembly, version 8.0.0.0.
I've also found the following link as well during my research that should allow at least some VB.NET usage in a Xamarin application: https://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/portable_visual_basic_net/xamarin-forms/
At the bottom of the site, there is a "Limitations of VB.NET in Xamarin.Forms" section. With the last item: "Xamarin does not support the Visual Basic.NET language," does that simply mean that you can't use a VB.NET dll in any Xamarin.Forms (portable) project that happens to also reference Xamarin.Forms.Core, Xamarin.Forms.Platform, and Xamarin.Forms.Xaml?
Thanks for any insight!

A DLL doesn't contain it's dependencies. If your DLL relies on Microsoft.VisualBasic, you will need to load the DLL that contains that assembly as well.
So either remove the Microsoft.VisualBasic assembly reference from the VB DLL, or include it as a reference in your Xamarin project (which may or may not be possible, I am not sure.)

Related

How to consume WinRT component inside Win32 dll project?

Using Registration-free WinRT it is possible to load WinRT components inside Win32 application.
What's the process to load WinRT component from inside Win32 dll? I tried the steps mentioned as part of Win32, but winmd files are not generating the corresponding header files.
Main usage scenario is dll can be loaded any application, like electron node addon or c# app etc.,
Without any changes to application, dll by itself should be able to consume WinRT component!
Did you add a reference to the WinMD file in the vcxproj and then installed the C++/WinRT NuGet package? This should make it generate the corresponding header files that your DLL project can then consume.
Following is the solution:
Was able to fix this in weird manner i.e. not a standard way to solve this.
Our use case was to use FFmpegInteropX inside win32 dll, so that we can use ffmpeg as a source reader and use the underlying hardware decode support. Mechanism is discussed detailly in the following link:
https://github.com/ffmpeginteropx/FFmpegInteropX/discussions/275#discussioncomment-3091100
Following changes were done to use WinRT component inside a Win32 dll:
Copied the WinRT generated files from the application to Win32 dll project
Before invoking any of the api from the generated runtime class, did LoadLibrary of the specific WinRT component into the dll
Now the make the necessary WinRT component call as it was done in standard win32 application
All modules were working as expected.
Above solution was copied from:
https://learn.microsoft.com/en-us/answers/questions/924996/how-to-consume-winrt-component-inside-win32-dll-pr.html
It's not a straight forward solution, also not sure if MS has any plans to add support for WinRT component inside dll project, if such support comes up then this may not be needed.

Add DLL in LinqPad 6

I'm using LINQPad 6 and I can't figure out how to add System.DirectoryServices.AccountManagement DLL. I see where I can pick from NuGet stuff, but not standard windows DLL. Previous versions used to list all the DLL and let me pick directly from there. Is that gone?
I don't think System.DirectoryServices.AccountManagement is part of the standard netcore library, but is available as a Nuget package.
If it was part of the standard library, then you would not need to add the dll, but just reference it.
There's no longer an option to add Framework assembly references. In keeping with Visual
Studio, all .NET Core Framework assemblies are referenced automatically.
From the Things that behave differently in LINQPad 6 section of https://www.linqpad.net/LINQPad6.aspx

VS2015 C++ DLL and such with Add Reference

I have three VS2015 projects (DLL, C++ App & C# App)
I created the DLL and targeted v4.5 Framework
I created the C++ Application and targeted the v4.5 framwork and then was able to add reference without an issue.
I create the C# Application and targeted the v4.5 framework and then the Add reference fails with check your assembly or COM message.
Both applications have the DLL project added to the solution.
What else can I check as to why my C# process can't add reference?
Thanks,
Mark
I got around it using PInvode and the C# project didn't need to Add Reference afterall. I had to manually edit out the Precompiled header stuff to force that NotUsing. Thanks for the quick response... just had a quick turn around for my boss. Handed a working Cipher DLL for use with both C++ and C# in his project.

Where are the .net core dlls stored on my computer?

I cannot find the dlls. Visual Studio does not tell you where they are stored. I want to load them into .net Reflector.
I know this is an old question, but if you're looking for these then check out the following location...
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App
Under there should be versions of .NET Core, and these are the runtime assemblies you'll need to load in Refelctor to see the source code.
Note - if you use an assembly reference from within Visual Studio (by maybe clicking F12 on a .NET Core datatype or interface), that will show the reference assembly and not the implementation assembly.
As an example, hitting F12 on ControllerBase gives me this...
C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.1.0\ref\netcoreapp3.1\
Microsoft.AspNetCore.Mvc.Core.dll
This is not the runtime assembly you need when using Reflector. GitHub is all fair and good for finding source code to one method, but you can't beat Reflector when you want to move between different classes in different files so as to work through an implementation pathway.
Hope this helps!
You can set them up I properties. They are still in the bin folder once the code is compiled. Although if you are planning on using the dll directly you can publish then first

Cannot add a reference to PCL from C++/Cli project

I have a Portable Class Library project, Net 4.5 platform activated. I can use it in other C# projects without problems.
Now, I have a C++/Cli project and I need to use some classes of the above PCL project.
When I add the reference to the PCL project, Visual Studio 2012 gives me an error because of different target platforms.
Is there a problem to add references to PCL projects from C++/Cli projects?
Thank you
This questionas was replied but for some unknown reason, the response has been deleted:
The solution is to edit the vcxproj file and change
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
to
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>