Search code examples
.netinteropcom-interoptlbimp

How do I avoid TlbImp.exe error TI1021 when creating PIA?


A few weeks ago, I ran this without any errors (just the normal warning):

tlbimp TypeLibrary.tlb /primary /out:My.Made.Up.Name.dll

Since then, I've run Windows Update (to get several months of updates).

But now, when I run the same command:

tlbimp TypeLibrary.tlb /primary /out:My.Made.Up.Name.dll

I get:

TlbImp : error TI1021 : Primary interop assemblies must be strongly named. This
can be accomplished by using either the /publickey, /keyfile or /keycontainer op
tions.

Is it likely that the behavior of tlbimp has changed as a result of updates, or is there some other reason I can't run tlbimp again?

I definitely didn't have a keyfile last time, so I'm unsure why I might need one this time.


Solution

  • So, I ran ILDASM against the dll and found that there wasn't any Primary Interop flag present, so as per @Hans Passant's comment, the cheese was not moved...

    I must have omitted the /primary argument.