Signing app leads to "This file format cannot be signed because it is not recognized" error
Hello all, wanted to sign the app with the signtool on my server during the CI/CD, but still getting "This file format cannot be signed because it is not recognized" even when the Install-NAVSipCryptoProviderFromNavContainer was used. Signing on my desktop works.
What I installed on the server>
- VS 2017 community - Windows 10 SDK (10.0.16299.0) for UWP: C#, VB, JS
- Used the Install-NAVSipCryptoProviderFromNavContainer for container based on microsoft/bcsandbox image
- Tried to do signtool.exe to sign the app.
Getting this in cmd>
C:\Windows\system32>SignTool sign /f \\devel\templates\build\NVRCodeSigning.p12 /p ****** /t http://timestamp.verisign.com/scripts/timestamp.dll "filename"
Done Adding Additional Store
SignTool Error: This file format cannot be signed because it is not recognized.
SignTool Error: An error occurred while attempting to sign: filename
Number of errors: 1
What could be wrong in this?
I have only seen this error in cases where the correct navsip.dll was not installed. Can you make sure that the only navsip.dll on your build machine is the one coming from NAV 2018 or later?
Have checked the machine, and I only found the navsip.dll in System32 folder (size 40640, version 11.0.21836.0) and in SysWOW64 (size 36032, version 11.0.21836.0). Of course, it found many other in docker windowsfilter folder, where are files for the docker images...
I'm getting the exact same issue within a docker that I've installed in my Azure account. I'm trying to keep this as simple as possible, so I have signtool.exe, my code signing certificate, and my .app all in the same folder. I created this VM and installed this docker image in April, 2018.
C:\Users\vmadmin\Documents>signtool sign /t http://timestamp.verisign.com/scripts/timestamp.dll "C:\Users\vmadmin\Documents\Professional Business Software, Inc._247 TimeTracker_11.0.0.1.app" Done Adding Additional Store SignTool Error: This file format cannot be signed because it is not recognized. SignTool Error: An error occurred while attempting to sign: C:\Users\vmadmin\Documents\Professional Business Software, Inc._247 TimeTracker_11.0.0.1.app
Number of errors: 1
As an update, I installed the latest version of NAV on my own computer, and code signing worked without a problem. On my computer it works, in the Azure docker image it doesn't. Just something to be aware of...
As @StanislawStempin stated in his comment, this is due to NavSip.dll, its correct.
@kine , as you are using docker and signing file from you local machine, you are facing this issue.
I have done below and issue is resolved.
Solution :
- Try to copy file from docker image to your machine.
- C:\Windows\System32\NavSip.dll
- C:\Windows\syswow64\NavSip.dll
- Once copied to your local machine under below path for respective DLL ,
- C:\Windows\System32\NavSip.dll
- C:\Windows\syswow64\NavSip.dll
- Run powershell command again.
Interesting, I did same as before today, and it worked. Before I tried same x times. Just did
Install-NAVSipCryptoProviderFromNavContainer -containerName xxx
again and than the signtool worked. And I have checked that the dlls are where they should be today. After the install-navsip… command runned again today, all worked. Something rotten in the world of 0 and 1...
Seems solved for now. Will try as part of the CI/CD...