Visual Studio 2005
2007. 10. 30.
안혁
http://hyok.kr


커맨드 창에서 다음과 같이 입력합니다.

> tlbimp DLL파일이름 /keyfile:키파일이름

ex) tlbimp namomime.dll /keyfile:sn.key

이렇게 실행하면 강력한 이름으로 서명된 Interop DLL인 NAMOMIMELib.dll 이 생성됩니다.


tlbimp.exe는 경로는 다음과 같습니다.

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\

참고 : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=243024&SiteID=1


------------------------------------------------------------------------------

Q

In VS2003 C++, I can configure strong names for ActiveX control references so I can sign and build my main assembly.  This is done from the Project  Managed Wrapper Properties.  But I cannot find an equivalent for this in VS2005 C++.  I see properties for references in Project References, but they are grayed out.  Is there a way to sign ActiveX controls/references in VS2005?

Thanks

ps)
Here are more details:

I have a VS 2005 C++ application that uses some COM components.  In order to sign my main assembly, I need to sign the Interop and AxInterop assemblies created for the COM components.

If I try to strong name my main assembly with a key file, then when I compile my application, I get errors similar to these:

LINK : error LNK2022: metadata operation failed (8004041F) : Referenced assembly 'Interop.xxxxxxLib.1.0' does not have a strong name
LINK : error LNK2022: metadata operation failed (8004041F) : Referenced assembly 'AxInterop.yyyyyyyy' does not have a strong name
LINK : fatal error LNK1255: link failed because of metadata errors

So I want to sign the Interop and AxInterop assemblies.

In VS2003, this can be accomplished by these steps:
1. Select Properties from the Project menu.
2. Click on Managed Wrapper in the tree on the left.  You will see $(OutDir)\Interop.$(InputName).dll for the Output Name.
3. Enter the Public Key File value and set the Strong Name type to Key File.
4. Click on Auxilary Managed Wrapper in the tree on the left.  You will see $(OutDir)\AxInterop.$(InputName).dll for the Output Name.
5. Enter the Public Key File value and set the Strong Name type to Key File.

My question is: How do I do the same thing above in VS 2005?
Or, how can I use the assembly linker for Interop and AxInterop assemblies? I don't know which name to use for module name for the assembly linker example in the link you provided:

al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk

Thanks,
Alan


A
Bingo!

I finally got it to work today!
Here's what I did for my VC++ 2005 app:

For each project in the solution:
Set the key file to mykey.snk in project properties linker advanced.

For each activex control, execute:
aximp /keyfile:mykey.snk someControl.ocx
(this generates AxsomeControlLib.dll and someControlLib.dll)

For each com library, execute:
tlbimp /keyfile:mykey.snk someComServer.tlb
(this generates someComServerLib.dll)

For each project in the solution that uses the components above:
Remove the current references for the components.
Add the component references using the files output from aximp and tlbimp.

Build the solution.

Note:
aximp and tlbimp are found in:
\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

Posted by 안혁 windfruit
이전버튼 1 2 3 이전버튼