Is there an easy way to sign a C++ CLI assembly in VS 2010?

前端 未结 6 1723
囚心锁ツ
囚心锁ツ 2020-12-30 00:18

Right now I am setting the Linker/Advanced/KeyFile option.

I am getting the \"mt.exe : general warning 810100b3: is a strong-name signed assembly and embedding

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 00:51

    Phil Atkin's reply and link is the way to fix this bug. Microsoft finally got around to addressing it for Visual Studio 2010 but they never released a service pack fix. Go to this link for the MS explanation and multiple ways to fix it.

    http://blogs.msdn.com/b/vcblog/archive/2011/03/11/10140139.aspx

    It worked for me. Thanks Phil. (I'd up vote you, but I'm still a newbie.)

    Edit for Mzedeler:
    Here is the most relevant info from the link that most people will be able to use. It's skips the history and multi-project implications. (Go to the link to see that stuff.)

    First: Fix the typo in the build process:

    1. In Windows 7: Go to Start->All Programs->Accessories
    2. Right click on Command Prompt icon and select "Run as Administrator" from the drop list.
    3. Type in: cd %ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32
    4. Type in: notepad Microsoft.Cpp.Win32.targets
    5. Find the “LinkEmbedManifest” target (search for: Target Name="LinkEmbedManifest")
    6. Under the above target and in the task “< Link” perform the following steps.
    7. Change property DelaySign
      • From : DelaySign ="%(Link.DelaySign)"
      • To : DelaySign ="$(LinkDelaySign)"
      • Verify you changed % to $ AND removed the period between Link and Delay.)
    8. Change property KeyFile
      • From : KeyFile ="%(Link.KeyFile)"
      • To: KeyFile ="$(LinkKeyFile)"
      • Verify you changed % to $ AND removed the period between Link and Key.)
    9. Save the changes and exit notepad.
    10. Exit the Command Window by typing in: Exit

    Redefine the “Key File” and “Delay Sign” properties used for signing your project:

    1. Get into MS Visual Studio 2010 and open your project.
    2. Right click on your "project" to bring up the properties page.
    3. Go to Configuration Properties->Linker->Advanced
    4. Overwrite the property “Key File” with your original key file. (for e.g. myfile.snk)
    5. Exit the Properties Page.
    6. Save and compile your program.

    These steps worked for my project. For more details, go to the link above that Phil provided.

    End Edit

提交回复
热议问题