Signing the WebServices DLL

Update:  These steps only work for the Vault 2011 version of the DLL.  Go here if you are using Vault 2012.

A couple of people have had issues with the fact that Autodesk.Connectivity.WebServices.dll is unsigned.  This is a problem if you want to sign your project.  Visual Studio won't let you sign something if it references an unsigned DLL. 

Fortunately, there is a trick you can use to sign the WebServices DLL.  The trick involves SN.exe, ILASM and ILDASM.exe, which are .NET tools provided by Microsoft. You basically de-compile the DLL to IL code, then you re-compile with a key.

Example BAT file:

set assembly=Autodesk.Connectivity.WebServices
set WinSDK=C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin
set NetDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727

"%WinSDK%\sn.exe" -k keyfile.snk
"%WinSDK%\ILDASM.exe" %assembly%.dll /out=%assembly%.il
move %assembly%.dll %assembly%.1.dll
"%NetDir%\ILASM.exe" %assembly%.il /dll /out=%assembly%.dll /key=keyfile.snk

If all goes well, you will end up with a signed WebServices DLL.  The original DLL is still there, but it's been renamed with a ".1.dll" extension.

This trick will work with any .NET assembly, so don't let unsigned references prevent you from signing your project.


Comments

3 responses to “Signing the WebServices DLL”

  1. Andries Muylaert Avatar
    Andries Muylaert

    Hello,
    Using the above trick, i tried to sign the Vault Explorer 2011 extension DLL. Re-compile is possible but when using this signed DLL the explorer add-in isn’t working anymore. It complains about missing assembly attribute ApiVersion.
    Is it possible to get around this issue ?

  2. You tried to sign Autodesk.Connectivity.Explorer.Extensibility.dll? That’s not a good idea because you are not the only one using that DLL. Vault Explorer uses it too. It’s part of the Vault client install, so you shouldn’t be modifying it. Even if you do get your project to work, a hotfix or service pack could come along and re-write it.
    The reason you can safely modify Autodesk.Connectivity.WebServices.dll is because it’s not part of the Vault 2011 product.
    So I should amend my earlier statement. You can sign DLLs yourself only if you are the exclusive consumer of that DLL.

  3. Hello,
    Please note that using a signed WebServices DLL is not a good idea when creating a job handler for the Vault job server. The custom job handler DLL must be copied in the \Explorer folder where an unsigned WebServices dll already resides. This dll has priority and should not be replaced resulting in a failing job handler. Also in this case you can say that you are not the exlusive consumer of the DLL.

Leave a Reply to Doug RedmondCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading