0

I have a .net dll that I want to use in my php application
I have tested the dll on .net app and it worked perfectly

my c# class:

namespace CryptoCs
{
    [Guid("15D16831-D6BE-43C4-AB4F-F0BAA35987DB")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("CryptoCs")]
    [ComVisible(true)]
    public class Crypto : iCryptoCs
    {
        public Crypto()
        {
        }

        public bool Login(string username, string password)
        {
            // some code
        }                                    
    }

    [Guid("5BDBB53A-571A-4EC7-B37E-A4D2A6A54DEB")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    [ComVisible(true)]
    public interface iCryptoCs
    {
        [DispId(1)]
        bool Login(string username, string password);        
    }
}

my usage code is:

$crypto = new COM('CryptoCs.Crypto');

this page give this error:

Failed to create COM object

I tried to register the dll using gacutil.exe the result was:

Assembly successfully added to the cache

but the error wasn't fixed

I tried regasm.exe and the result is:

Types registered successfully

still the error is the same

I tried REGSVR32.exe but it gabe me this error:

Can't find entry point

I'm on windows server 2003 sp2 using vs2010 .net4

3
  • 2
    The standard registration tool for .NET assemblies is indeed regasm.exe, with /Codebase if you don't put it in the GAC (but you put it in the GAC). The progid you use in php should be the same as what you specified, so "CryptoCs", not "CryptoCs.Crypto". Also, remove all the ClassInterface and InterfaceType attributes, it's better to use the defaults. Commented May 9, 2013 at 14:50
  • @SimonMourier I will have to wait till Saturday to test this. thanks anyway. Commented May 9, 2013 at 16:11
  • @SimonMourier Working !!!!!! you have my gratitude, thank you. please add your answer so I can mark it. Commented May 11, 2013 at 10:36

1 Answer 1

1

The standard registration tool for .NET assemblies is indeed regasm.exe, with /Codebase if you don't put it in the GAC (but you put it in the GAC apparently).

The progid you use in php should be the same as what you specified in .NET, so "CryptoCs", instead of "CryptoCs.Crypto" here

Also, I suggest you remove all the ClassInterface and InterfaceType attributes, as it's better to use the defaults in general.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.