views:

31

answers:

1

How can I sign a managed c++ dll with a .pfx file??

Or is there a way to include the unsigned managed c++ dll in a signed c# project? I realy dont need a signed dll I just need VS to stop giving me the Error "Referenced assembly 'SlimDX' does not have a strong name." in my c# project that must be signed.

A: 

If you are building the dll, there is a post build step in VS that will allow you to run the signing utility. Check out this link (for .Net 4.0, there are other versions available from the page) http://msdn.microsoft.com/en-us/library/xc31ft41.aspx

On another note, I don't think you will be able to sign your dll and include an unsigned dll, so you will either have to sign the C++/CLI dll or not sign yours.

pstrjds
So I added the line "[assembly:AssemblyKeyFileAttribute("VOS.snk")];" in my AssemblyInfo.cpp file. But now it gives me the error "Key file "VOS.snk" is missing the private key needed for signing"... I have the pfx file, but how am I suppose to use it?
zezba9000
You need to extract your private key from the pfx file. I haven't ever done that, I usually just have an snk file for my signing. You can check out this link: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/7f31e70d-d5a4-4e15-a3f7-18588eeb8c78 for help, I briefly looked at the answer links and they may offer some help.
pstrjds
sn.exe supports signing with PFX files (http://blogs.msdn.com/b/shawnfa/archive/2006/02/14/531921.aspx). This might be problematic if you're making this a post-build step, however, since sn.exe will ask for the PFX file's password.
htw