OLE error 80131522 when trying to access a .NET assembly side by side from a native application

I have an application (Delphi Native code) that needs to access the .NET assembly (provides several COM classes. I want to do this using the build and manifest side by side. I did this with the .NET test assembly, but I have build problem, which I have to access.

When registration is registered, I can create an instance of the COM class. As soon as I unregister the assembly and try to access side by side, I get the above error. My own application has an application manifest that has a simple build dependency.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32"
                    name="TestApplication.exe"
                    version="1.0.0.0"/>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        name="TestAssembly"
        version="1.0.0.0"
        processorArchitecture="x86"
        publicKeyToken="xxxxxxxxxxxxxxxx"
        type="win32"/>
    </dependentAssembly>
  </dependency>
</assembly>

My assembly manifest, which I have embedded as a resource in my .net assembly, is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    name="TestAssembly"
    version="1.0.0.0"
    processorArchitecture="x86"
    publicKeyToken="xxxxxxxxxxxxxxxx"
    type="win32"/>
  <clrClass
    clsid="{F3F1623D-DB4A-4152-9A5D-5A465AD3A318}"
    progid="TestAssembly.MyObject"
    threadingModel="Both"    
    name="TestAssembly.MyObject"
    runtimeVersion="v2.0.50727">
  </clrClass>
  <file name="TestAssembly.dll">
  </file>
</assembly>     

, . , (, , btw), , SxS .

(, ) .NET, , . , , .

+3
1

.Net, mt.exe,

c:>mt.exe -nologo -managedassemblyname:"your_binary.dll" -nodependency -out:"temp_file.manifest"
c:>mt.exe -nologo -manifest "temp_file.manifest" -outputresource:"your_binary.dll";2

temp_file.manifest assemblyIdentity verbatim dependency\dependentAssembly delphi.

FYI: , DLL .

+3

Source: https://habr.com/ru/post/1772872/


All Articles