2017-02-13 7 views
2

Clickonceによってアプリケーション(WPF)がインストールされているため、Windowsは自分の会社を信頼できる発行元として認識することができます。私のC.Iで使用されたコマンドラインは次のとおりです。工具(ダイヤモンド<とパラメータが>状況を例示するためにのみ使用される):ClickonceアプリケーションですべてのファイルにMSBuildの署名を付ける方法

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /target:clean;build;publish /p:ApplicationVersion=<VERSION> /p:SignAssembly=true /p:GenerateManifests=true /p:SignManifests=true /p:AssemblyOriginatorKeyFile=<PFX_PATH> /p:ManifestCertificateThumbprint=<CERTIFICATE_ID> /property:Configuration=<CONFIGURATION>;PublishDir=<PUBLISH_DIR>;BootstrapperEnabled=true;PublishUrl=<PUBLISH_URL>;InstallUrl=<INSTALL_URL>;UpdateUrl=<UPDATE_URL> C:\hudson\slave\workspace\NIMBUS-NFE-NFEasy2\NFeasy2\NFeasy2.sln 

問題がある。のみSETUP.EXE署名、およびのみSHA-256アルゴリズムを用いています。したがって、ユーザーがアプリケーションを実行すると、発行者は認識されません。また、Windows XPで実行している場合、SOが署名を認識しないため、セットアップは実行されません(WinXPにはSHA-1が必要です)。

SHA-1アルゴリズムとSHA-256アルゴリズムの両方ですべてのファイルに署名するようにプロジェクトやコマンドラインを設定するにはどうすればよいですか?また、これは、アプリケーションが実行されるたびにユーザーの許可を求めるプロンプトを表示しますか?そうでない場合は、そうする方法はありますか?

ありがとうございます!

答えて

0

インターネットを通じて多くのソリューションを読んだ後、完全な署名を行うためのバッチファイルを作成しました。これが唯一の特定のバージョンで動作することに注意してください、と私は、次の順序で私のパスに入れなければならなかった:

C:\Program Files (x86)\Windows Kits\8.1\bin\x86; 

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin; 

スクリプトは以下の通りです:

rem renaming the setup.exe because it will be treated separately 
ren setup.exe setup._ 

rem removing the .DEPLOY extension, getting back the original one 
for /r %%x in (*.deploy) do ren "%%x" *. 

rem signing all files with my certificate 
for /r %%x in (*.exe *.dll) do signtool.exe sign /fd sha1 /as /sha1 <MY_CERTIFICATE> "%%x" 
for /r %%x in (*.exe *.dll) do signtool.exe sign /fd sha256 /as /sha1 <MY_CERTIFICATE> "%%x" 

rem updating the manifest with the new signatures 
for /r %%x in (*.manifest) do mage.exe -update "%%x" 

rem signing the manifest file 
for /r %%x in (*.manifest) do mage.exe -sign "%%x" -ch <MY_CERTIFICATE> 

rem putting the .DEPLOY extension in all files renamed previously 
for /r %%x in (*.exe *.dll *.config *.cer *.ttf *.ico *.xml *.p7b) do ren "%%x" *.*.deploy 

rem getting back setup.exe 
ren setup._ setup.exe 

rem signing setup.exe file 
signtool.exe sign /fd sha1 /as /sha1 <MY_CERTIFICATE> setup.exe 
signtool.exe sign /fd sha256 /as /sha1 <MY_CERTIFICATE> setup.exe 

rem updating MyApp.Application file 
for /r %%x in (*.manifest) do mage.exe -update MyApp.Application -appm "%%x" 

rem signing MyApp.Application file 
mage.exe -sign MyApp.Application -ch <MY_CERTIFICATE> 

rem updating the new signed file to the destiny folder 
for /r %%x in (*.application) do xcopy MyApp.Application "%%x" /y 
関連する問題