Auto-entering Password In Sn.exe

前端 未结 7 2109
猫巷女王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

    I had this problem come up today, with a C++ DLL that I use in a ClickOnce C# app.

    I set up delay signing on the DLL, then used a post-build event to run SN like so:

    ECHO  | sn.exe -R $(OutDir)$(TargetFileName) $(MSBuildProjectDirectory)
    

    Gotta love the old-school batch methods. ECHO prints your password, the pipe | pipes that output along to SN.exe, which takes the password.

    You probably won't need delay signing and the -R switch like I did, but you get the idea.

    EDIT: THIS PROBABLY NO LONGER WORKS - my answer was from 2013 and I was using VS2010 back then.

提交回复
热议问题