Jump to content
dummzeuch

Import .NET Assembly list is empty

Recommended Posts

I just tried to import a .NET assembly into the Delphi IDE:

 

  1. Component -> Import Compoent
  2. Select "Import .NET Assembly", press Next
  3. There I got a list of available assemblies, but that list is empty ???
  4. Pressing "Add" and selecting the DLL I wanted to import got me the OLE error 80131124, which according to https://www.megos.ch/files/content/diverses/doserrors.txt means "Index %s not found", which isn't really helpful

 

Is it really possible, that the list is empty? According to gacutils I have got a sh*tload of assemblies in the Global Assembly Cache
 

This is Delphi 10.3.3

Edited by dummzeuch

Share this post


Link to post

Trying the same with Delphi 10.2.3 at least gives me a non-empty list but unfortunately the assembly I want to import is not there.

 

Pressing "Add" and selecting the DLL dosn't show an error, but the assembly still isn't listed.

 

I noticed that Delphi seems to look for assemblies in c:\windows\assembly\gac_32 which isn't visible in the explorer. Explorer shows only c:\windows\assembly with the assembly name, version, processor architecture etc. Delphi seems to list most of the entries where the processor architeture is x86 so I assume that's the way the exploer show the content of the subdirectory gac_32.

 

The assembly I want to import isn't listed there.

 

According to the documentation on the Global Assembly Cache it is stored in c:\windows\microsoft.net\assembly. If I look there, I find sub directories gac_32, gac_64 and gac_msil and in gac_32 I can see the assembly I am looking for.

 

So, does that mean that Delphi only allows importing 32 bit assemblies?

And is it looking in the wrong folder even for that?

Can I simply copy the directory for the assembly I want from one folder to the other?

Share this post


Link to post

OK, I tried to copy the entry from c:\windows\Microsoft.NET\Assembly\gac_32 to c:\windows\Assembly\gac_32 . It still doesn't show up in Delphi and also doesn't show up in the explorer view of :\windows\Assembly . So that's probably not the solution.

Share this post


Link to post
32 minutes ago, Lars Fosdal said:

Yes, I read that. I used gacutil.exe to install the assembly. It's also listed in the output of gacutil /l .

 

EDIT:

gacutil from .NET 2.x does not list the assembly, so it probably has the same problem as Delphi 10.2.3.

Edited by dummzeuch

Share this post


Link to post

Is there a command line tool that does the same as the Import Component wizard?

I couldn't find anything in the online help.

Share this post


Link to post
8 hours ago, Bernard said:

I am having this issue in 10.4 update 1.  Have you ever managed to find a resolution?

No, but I noticed that the problem hasn't been fixed in 10.4. Never looked at it in 10.4.1 because I found a different way that does not require a dotNET assembly. That was my "last best" solution anyway.

 

(* "second best" would put it too mildly. Avoiding this was by far the best option.)

Share this post


Link to post

I have the same problem on Delphi ver. 10.3 importing a Net 5.0 assembly.

 

I figured out that if i have fewer than around 7 property/functions the import goes well.

If i have more then i get the 80131124 error when adding the assembly.

 

Delphi is perfektly cabable to call more than 7 functions. It is just the IDE that can't autogenerete the interface/TLB .pas file

Share this post


Link to post

.Net import still producing empty list in latest version "Delphi 11.1" :classic_sad:

 

Share this post


Link to post

Uhmm, may be I'll probably say bullshit, but you can import assemblies from .NET only if they are flagged as COM compatible (they must be compiled in this way from Visual Studio).

 

Others way are to use some instruments like CrossTalk or also JCL (from Jedi project). But I don't think that you will able to import like a component, only to call them like a DLL.

 

You can also use some open source software like " ILSpy, the open-source .NET assembly browser and decompiler" to analize the .NET DLL.

OF COURSE YOU MUST HAVE THE RIGHTS TO DO SO !!!

 

Edited by DelphiUdIT

Share this post


Link to post

There is a bug report on this (at least one). I even used one of my support tickets for this but Embarcadero could not help me. That was back, when Delphi 10.2 was the latest and greatest version. If I remember correctly they are looking into the wrong registry branch, so the fix should be easy (but maybe I'm overlooking something). I was lucky in so far as it turned out I didn't need to use an assembly after all.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×