strong names problem...

I have a console application in c# that uses objects that is in another dll(unmanaged code).
when I reference from the project to the dll it creates another dll with the name Interop.MyDll.dll

now, I created snk file with sn.exe and added reference to it from the project

[assembly: AssemblyKeyFile("@"..\..\exampleSN.snk"")]

with this it wont compile because of:
"Assembly generation failed -- Referenced assembly 'Interop.MyDll' does not have a strong name"

and if i try to use tlbimp.exe on Interop.MyDll.dll with the above snk it says:
"TlbImp error: The input file 'interop.mydll.dll' is not a valid type library"

is there a reason to it
have I done something wrong with the strong names

thank you.


P.S.
the reason i need a strong name is because i need to run this app from the local net and i am using caspol with the strong name property



Answer this question

strong names problem...

  • DumbLuck61

    You don't use tlbimp on the Interop.x.dll (created automatically by Visual Studio when adding a COM reference), but the original COM dll.



  • William Vaughn

    well, I can't do that because I hadn't wrote that dll
    and I don't have it's code.
    anyway, I found a solution to all this:
    apparently you can use ildasm and then ilasm with /key property
    like:
    "ildasm /out:Interop.x.dll.il Interop.x.dll"
    and then "ilasm /dll /resource=Interop.x.dll.res Interop.x.dll.il /out=Interop.x.dll /key=someSN.snk"

    and vualla: you have the dll with a strong name :-)

  • Chris Walters

    u should mention strong name on that assembly.
  • philipk

    I've run into the same problem, however I don't have an interop version of my C++ Dll. How did you generate it
  • ntalb

    well the dll I'm referencing is a normal dll(not COM)
    with objects and structs.
    and the vs adding it as interop.x.dll
    but i need this dll to have a strong name(it is not my dll, but someone else)

  • MON205

    You can just use sn tool to sign that dll as well
    Aslo tlbimp has /keyfile arg to auto sign.

  • strong names problem...