Auto-entering Password In Sn.exe

前端 未结 7 2145
猫巷女王i
猫巷女王i 2021-01-05 01:58

I need to create post build event to perform the following:

sn -i MyKey.pfx MyKeyContainerName
tlbimp $(ConfigurationName)\\MyCom.tlb /out:$(ConfigurationNam         


        
7条回答
  •  长情又很酷
    2021-01-05 02:25

    After a long investigation i can run sn.ex for various automated environments such as Azure devops. My code is here:

    Start-Process cmd.exe 
    Sleep 3
    $WshShell = New-Object -ComObject WScript.Shell
    Sleep 3
    $WshShell.sendkeys(".\sn.exe -i  $PfxCertificatePath  VS_KEY_10D1C85C6387479B{Enter}");
    Sleep 3;
    $WshShell.sendkeys("**password**{Enter}");
    Sleep 3;
    $WshShell.sendkeys("{Enter}");
    

提交回复
热议问题