I am not aware of a simple way to strong name an assembly that has not been previously delay signed. Keep in mind all assemblies referenced by strong named assemblies must be strong named as well. If there are no other unsigned assemblies referenced then you can first run ildasm tool to retrieve the MSIL code and then compile it back into an assembly using ilasm this time by specifying a key pair.
However you might choose not to do this. It still not the end of the world and I would still recommend using the COM shim - just without the strong name. This will at least place your assembly into a separate AppDomain and give you types isolation. There are some remote security risks associated with using unsigned assemblies and you need to assess the risks before going down this road.
To achieve loading unsigned assemblies you need to make minor modification to the code of the COM shim. In the below snippet from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_shim.asp you will just need to remove the specification of the PublicKeyToken.
static LPCWSTR szAddInAssemblyName = L"ManagedAddIn, PublicKeyToken=6c96c7507b8e2be8";
static LPCWSTR szAddInAssemblyName = L"ManagedAddIn"; static LPCWSTR szConnectClassName = L"ManagedAddIn.Connect"; LPCWSTR ShimConfig::AssemblyName() { return szAddInAssemblyName; } LPCWSTR ShimConfig::ConnectClassName() { return szConnectClassName; }
Misha (VSTO team is hiring. We would like to hear from you http://tinyurl.com/ZQGW2) |