Posts

Showing posts from October, 2010

C++/CLI strong named assemblies in Visual Studio 2010

Spanish version / Versión en Español In a previous post, we saw how to give a C++/CLI assembly a strong name in Visual Studio 2008. On VS 2010, this doesn't work quite the same way; a fix is meant to come in a future service pack. Meanwhile, the new way to do this is as follows: In Solution Explorer, right-click the project, then go to Properties->Linker->Advanced->Key File, and select the .snk file generated with sn.exe. In the same place (Linker->Advanced), set the Delay Sign property to Yes . Add the following Post Build Event to the project: sn -R <dll> <key file> To achieve the previous, some macros sus as $(ProjectDir) are useful. Use as needed. In my case, the post build event ended up being this:: "$(FrameworkSDKRoot)"bin\sn -R $(SolutionDir)Debug\NombreDLL.dll $(ProjectDir)NombreDLL.snk I used the SolutionDir macro because in my particular project, the compiled dll is saved to the solution's Debug folder (for

Strong named assemblies C++/CLI en Visual Studio 2010

Versión en inglés / English version En un post anterior vimos cómo darle un strong name a una assembly C++/CLI en el Visual Studio 2008. En el 2010, esto no funciona del todo bien; se dice que saldrá un fix pertinente en un futuro service pack. Mientras tanto, la nueva forma de hacer esto es la siguiente: En el Solution Explorer, click derecho al proyecto->Propiedades->Linker->Advanced->Key File, y hacer que apunte al archivo .snk que generamos con el programita sn.exe del SDK de Windows. En el mismo lugar (Linker->Advanced), setear la propiedad Delay Sign a Yes . Agregarle al proyecto un Post Build Event de la forma: sn -R <dll> <key file> Para hacer lo anterior, son útiles macros como $(ProjectDir). Usar las necesarias. En mi caso, el post build event quedó así: "$(FrameworkSDKRoot)"bin\sn -R $(SolutionDir)Debug\NombreDLL.dll $(ProjectDir)NombreDLL.snk Usé la macro SolutionDir porque este proyecto en particular guarda la