Search code examples
.netc++clrsign

Creating a strongly-named managed (/clr) C++ assembly


I have a managed C++ assembly using the /clr switch that I am trying to sign as per this question with the following post-build step:

sn -Ra "$(TargetPath)" MyKey.snk

However this is giving the following error:

C:\Path\Assembly.dll does not represent a strongly named assembly

What is going wrong?


Solution

  • Have you marked the assembly for delay signing in AssemblyInfo.cpp?

    [assembly:AssemblyKeyFileAttribute("MyKey.snk")];
    [assembly:AssemblyDelaySignAttribute(true)];