Can ESRISignAddIn.exe be run silently?

4439
5
Jump to solution
05-11-2015 12:07 PM
MarkRubelmann
New Contributor III

I'm trying to build and sign an add-in on a build server, which means everything has to run without a GUI.  Unfortunately, I can't seem to get the ESRISignAddIn.exe tool to run without popping up a window.  Even when I use the /r, /c, and /p options and the signing is successful, it still feels the need to pop up a message box to let me know everything is okay, which then causes it to throw an InvalidOperationException.  (The message is "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.")

Is there a workaround for this?  Perhaps an undocumented argument?  Some fancy Windows trick to beat this dialog into submission?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
MarkRubelmann
New Contributor III

It seems I answered my own question!  Using the top secret argument "/s" makes it do what I want.  If only that had been included in the /? output...  *sigh*

View solution in original post

0 Kudos
5 Replies
MarkRubelmann
New Contributor III

It seems I answered my own question!  Using the top secret argument "/s" makes it do what I want.  If only that had been included in the /? output...  *sigh*

0 Kudos
by Anonymous User
Not applicable

I'm hoping that someone is still watching this thread... Mark Rubelmann​ was there any trick to getting the silent flag to work on your build machine?  I'm finding if I call ESRISignAddIn in a command prompt with /s (IE... ESRISignAddIn <ADDIN_PATH> /s /c:<CERT> /p:<PASS>) no UI is shown.  However when the exact same command is given on our jenkins build server, I'm still getting the InvalidOperationException.

0 Kudos
MarkRubelmann
New Contributor III

Deidre,

I don't recall there being any special tricks other than /s, but here are a few things that I might be doing differently than you:

  • I've got ESRISignAddIn.exe checked in to source control, so it winds up being executed from a location within my job's workspace.
  • ESRISignAddIn.exe is invoked from a batch file.  The batch file is executed by a Jenkins batch command step, rather than the .exe being called directly.
  • I'm specifying the /r parameter in addition to /c, /p, and /s.  I see you don't have /r in your example above.

If it's helpful, here's the batch file that I use:

@echo off

REM Print some help if the user is clueless.
if "%~1"=="" (
    echo Usage: esriSignAddIn.bat ^<input.esriaddin^> ^<output.esriaddin^> [password] [certificate]
    goto :eof
)

REM Prompt for password
cls
echo Signing %1
echo.
if "%~3"=="" (
    set /p password="Password: "
) else (
    set password=%3
)

REM Clear the displayed password
cls
echo Signing %1
echo.
echo Password:
echo.

REM Set up the certificate path
set thisDirectory=%~dp0%
if "%~4"=="" (
    set certificatePath=%thisDirectory%certificate.pfx
) else (
    set certificatePath=%4
)

REM Sign the binary
set ESRISignAddInExe=%thisDirectory%ESRISignAddIn.exe
%ESRISignAddInExe% %1 /r:%2 /c:"%certificatePath%" /p:%password% /s

Good luck!  Let me know if you get it working!

by Anonymous User
Not applicable

It turns out the trick was the batch script... for whatever reason calling it directly was ignoring the /s flag.

Thanks for the help!

0 Kudos
MarkRubelmann
New Contributor III

Awesome, I'm glad it worked for you!

0 Kudos