Delphi Prism (Oxygene 4.0.25) will not embed interop

I am using Delphi Prism (Oxygene version is 4.0.25) with .NET 4.0. It will not embed my interop. I made it manually with tlibimp and the safarray switch only so it is not a strong named signed primary but it has the ImportedFromTypeLibAttribute. The requirements for PIA import says the interop must have a PrimaryInteropAssemblyAttribute or ImportedFromTypeLibAttribute. “OR” being the operative word.

I’m using the VS 2010 shell set to .NET 4.0. The app works fine using the interop externally but when I set the interop reference property to embed, it fails to build and throws an error.

The only build errors provided are:
The element ‘Target’ has invalid child element 'OxygeneCompiler’
The element ‘Target’ has invalid child element 'CreateOxygeneManifestResourceName’
The element ‘PropertyGroup’ has invalid child element 'UseXmlDoc’
The element ‘PropertyGroup’ has invalid child element 'PrepareResourceNamesDependsOn’
The element ‘PropertyGroup’ has invalid child element 'MSBuildAllProjects’
The element ‘PropertyGroup’ has invalid child element 'CreateManifestResourceNamesDependsOn’
The element ‘PropertyGroup’ has invalid child element '_DocumentationFileProduced’
The element ‘ItemGroup’ has invalid child element 'OxygeneAssemblyNameItem’
The element ‘ItemGroup’ has invalid child element '_Temporary’
The element ‘ItemGroup’ has invalid child element ‘_MDBSymbolsIntermediatePath’

Anyone know the solution for this ?
Thanks for any clues.
bilm

Oxygene 4.0.25 is mighty old, and probably shipped before .NET 4.0 was even out. Can i recommend trying a newer version of Oxygene? we shipped 7.0 last month.

After much searching/researching I discovered that for the embed feature to work, .NET COM client apps need to implement class INTERFACES not classes as I had done. Coming from Win32 and being new to .NET,
I assumed the class interface was INameofInterface for the NameofInterfaceClass. Not so as it turns out. There is another sort of intermediary interface called NameofInterface and this is the one needed for embedding.

If you disassemble the interops to .IL files and view them, the class interfaces are the ones with the CoClass Attribute. So all that is needed is to change the declarations from classes to class interfaces. Basically just clip “Class” off from the ends of the existing declarations.

In many case this is all that will be needed. But some classes may implement an interface other than its base interface. In that case you will not be able to call any methods for the additional interface using the class interface. You will have to declare the additional interface separately.

Yet after I made all these changes, it would still not embed the interop. So there is still something I need to do or am doing wrong.

I checked the Oxygege version I’m using and according to the website here this version supports embedding interops…

Hello,

Unfortunatelly it is impossible to fix the old version if there were some bugs. But you can send us a testcase that shows the problem and we will test it with latest Oxygene and fix the problems if there are any, You can send the project at support@remobjects.com if you want to keep it privatelly.

Best regards.