Using a WINMD library causes a Strong Name Validation exception

0

Using the Visual Studio 11 beta on the Windows 8 consumer preview.

The problem is: if a try to use a class from a class library that has its output type set to WinMD, I get a Security exception stating that "Strong Name Validation" failed (Exception from HRESULT: 0x8013141A). I am just trying to run (F5) a small test app using Visual Studio.

The problem goes away if I set the output type to "Class Library". A small (and rather trivial) test project can be found here:

http://download.tallcomponents.com/WinRTApplication3.zip

I have set the "Sign the Assembly" flag for the class library, using a newly generated .snk file (without password). Running sn -vf on the generated ClassLibrary1.winmd file shows:

ClassLibrary1.winmd is a delay-signed or test-signed assembly

So maybe the problem is basically that the output has not been "properly" signed? I just don't know what to do to solve this, given that I have specified the class library to be signed, nor do I understand why this happens only when outputting to a WinMD file. I am assuming at this point that I do not need an "official" certificate just for debugging and testing.

Well, remains to say that I am sorry if this is a beginners question. I tried to "google" an answer, but I mainly got hits older than 2 years, and google suggesting "wind" instead of winmd…

Can't even create a new tag "winmd" here… (not enough reputation)

c#
.net
code-signing
windows-runtime
strongname
asked on Stack Overflow May 14, 2012 by Marco Kesseler • edited May 14, 2012 by Marco Kesseler

1 Answer

1

If you're getting a strong name validation error on a winmd file, it's typically because you're using a toolset that doesn't understand the .winmd file format.

.winmd files cannot be strong name signed.

In this case, it's possible that the problem is caused because you're trying to strong name sign a component library - C# component libraries produce hybrid .winmd files that contain both windows metadata and C# IL.

Why are you trying to strong name sign your component? Strong name signing is mostly used when putting assemblies into the GAC and .winmd files cannot be inserted into the GAC.


User contributions licensed under CC BY-SA 3.0