Signing Problems

Add-in Express™ Support Service
That's what is more important than anything else

Signing Problems
dll locked  
gerwald




Posts: 3
Joined: 2015-06-17
Hi Addin-Express,

We are facing massive problems when we try to sign our addins' output for deployment when using our code signing certificate.
We use Addin-Express' built-in signing options (in visual studio via context menu) which signs adxloader.dll, adxloader64.dll, adxloader.dll.manifest.

Rarely it works, but most of the time it fails (first error in appendix), stating that our addin is locked by another process (most probably MSBuild.exe).
Since we also have to build 2 Addin Versions (a user, and an admin version), there are also problems when signing adxloader.dll.manifest's xml after editing "privileges" Attribute of loadersettings. (second error in appendix)

We have already tried to use signtool.exe to manually sign adxloader, ... but then we have the problem, when building our setup project, adxloader.dll, adxloader64.dll will always be overwritten with the unsigned version (supported by addin-express)

Could you give an advice how we should sign the .dlls in a way it works smoothly. Till now signing is just really annoying.


Thanke you!


Following are the erros we get:

Severity Code Description Project File Line Suppression State
Warning Add-in Express for Microsoft Office and .NET error: Signing failed (IPMSAddin). Failed to sign the 'C:\Users\user1\Source\Repos\Unycom\Outlook Integration\IPMSAddin\Deploy\Release\IPMSAddin.dll' file (HRESULT = -2147467259).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(Inner Exception)
Date and Time: 21/11/2019 08:14:51
Machine Name: T490
IP Address: fe80::805f:7b05:19c0:d90%25
Current User: T490\user1

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Users/user1/Apps/Bin/Packages/VS2017/AddinExpress.VSPackage.dll
Assembly Full Name: AddinExpress.VSPackage, Version=9.4.4644.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 9.4.4644.0

Exception Source: AddinExpress.VSPackage
Exception Type: System.ComponentModel.Win32Exception
Exception Message: The process cannot access the file because it is being used by another process
Exception Target Site: SignCode

---- Stack Trace ----
AddinExpress.Projects.Common.NativeSigner.SignCode(pSubjectInfo As IntPtr, pSignerCert As IntPtr, pSignatureInfo As IntPtr, pProviderInfo As IntPtr, tsaServer As String, useSHA256 As Boolean, appendSignature As Boolean)
AddinExpress.VSPackage.dll: N 0395 (0x18B) IL
AddinExpress.Projects.Common.NativeSigner.Sign(appPath As String, cert As X509Certificate, tsaServer As String, useSHA256 As Boolean, appendSignature As Boolean)
AddinExpress.VSPackage.dll: N 0062 (0x3E) IL



(Outer Exception)
Date and Time: 21/11/2019 08:14:51
Machine Name: T490
IP Address: fe80::805f:7b05:19c0:d90%25
Current User: T490\user1

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Users/user1/Apps/Bin/Packages/VS2017/AddinExpress.VSPackage.dll
Assembly Full Name: AddinExpress.VSPackage, Version=9.4.4644.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 9.4.4644.0

Exception Source: AddinExpress.VSPackage
Exception Type: System.ComponentModel.Win32Exception
Exception Message: Failed to sign the 'C:\Users\user1\Source\Repos\Unycom\Outlook Integration\IPMSAddin\Deploy\Release\IPMSAddin.dll' file (HRESULT = -2147467259).
Exception Target Site: SignBinaryFile

---- Stack Trace ----
AddinExpress.Projects.Common.Signer.SignBinaryFile(certificate As X509Certificate2, filePath As String, sha1 As Boolean, sha256 As Boolean, timestamp As String, timestampSHA256 As String)
AddinExpress.VSPackage.dll: N 0094 (0x5E) IL
AddinExpress.Projects.Common.Registrator.SignProject(project As Project, projectFolder As String, primaryOutput As String, intermediateDir As String, supportLoader As Boolean)
AddinExpress.VSPackage.dll: N 0670 (0x29E) IL IPMSAddin AddinExpress.VSPackage 0


Since we also have to build 2 Addin Versions (a user, and an admin version), there are also problems when signing adxloader.dll.manifest's xml format after editing "privileges" Attribute of loadersettings:

Severity Code Description Project File Line Suppression State
Warning Add-in Express for Microsoft Office and .NET error: Signing failed (IPMSAddin). '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.
---------------------------------------------------------------------------------------------------------------------------------------------------------
Date and Time: 21/11/2019 08:22:53
Machine Name: T490
IP Address: fe80::805f:7b05:19c0:d90%25
Current User: T490\user1

Application Domain: DefaultDomain
Assembly Codebase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
Assembly Full Name: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly Version: 4.0.0.0

Exception Source: System.Xml
Exception Type: System.Xml.XmlException
Exception Message: '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.
Exception Target Site: Throw

---- Stack Trace ----
System.Xml.XmlTextReaderImpl.Throw(e As Exception)
System.Xml.dll: N 0039 (0x27) IL
System.Xml.XmlTextReaderImpl.Throw(res As String, args As String[])
System.Xml.dll: N 0041 (0x29) IL
System.Xml.XmlTextReaderImpl.ThrowInvalidChar(data As Char[], length As Int32, invCharPos As Int32)
System.Xml.dll: N 0000 (0x0) IL
System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
System.Xml.dll: N 0000 (0x0) IL
System.Xml.XmlTextReaderImpl.ParseDocumentContent()
System.Xml.dll: N 0724 (0x2D4) IL
System.Xml.XmlTextReaderImpl.Read()
System.Xml.dll: N 0140 (0x8C) IL
System.Xml.XmlLoader.LoadDocSequence(parentDoc As XmlDocument)
System.Xml.dll: N 0013 (0xD) IL
System.Xml.XmlLoader.Load(doc As XmlDocument, reader As XmlReader, preserveWhitespace As Boolean)
System.Xml.dll: N 0180 (0xB4) IL
System.Xml.XmlDocument.Load(reader As XmlReader)
System.Xml.dll: N 0047 (0x2F) IL
System.Xml.XmlDocument.Load(filename As String)
System.Xml.dll: N 0019 (0x13) IL
AddinExpress.Projects.Common.Signer.RemoveSignatureFromLoaderManifest(manifestPath As String)
System.Xml.dll: N 0006 (0x6) IL
AddinExpress.Projects.Common.Signer.SignLoaderManifest(certificate As X509Certificate2, manifestPath As String, assemblyHash As String, assemblyName As String, keyInfoType As XMLKeyInfoType)
System.Xml.dll: N 0000 (0x0) IL
AddinExpress.Projects.Common.Registrator.SignProject(project As Project, projectFolder As String, primaryOutput As String, intermediateDir As String, supportLoader As Boolean)
System.Xml.dll: N 0893 (0x37D) IL IPMSAddin System.Xml 0
Posted 21 Nov, 2019 02:47:53 Top
Andrei Smolin


Add-in Express team


Posts: 17360
Joined: 2006-05-11
Hello gerwald,

It looks like you haven't set project dependencies and this lets Visual Studio build the projects in parallel, not sequentially. Is this the case?

gerwald writes:
Exception Message: '.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.


Are you saying that this error is not thrown if you simply build your project (e.g. to debug it)? Can this issue relate to your editing the "privileges" attribute?

gerwald writes:
we also have to build 2 Addin Versions (a user, and an admin version)


In section Dual-Purpose Installers (see the PDF file in the folder {Add-in Express}\Docs on your development PC), we describe a possibility to create a WiX setup project that allows the end user to choose whether to install the add-in for all users on the PC or for the current user only.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Nov, 2019 04:12:59 Top