VB.Net Cannot Start Application — Cannot continue. The application is improperly formatted. Contact the application vendor for assistance.

今天有位同事向我說有一個我寫的應用程式當他打開時出現錯誤
Cannot continue. The application is improperly formatted. Contact the application vendor for assistance.

由於我之前重新發報過這個應用程式到另一個網絡地址…所以我便再一次發報了..
之後還是有同一個錯誤出現..

之後按了一下Details去看看什麼原因

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of \NetworkLocationShareChiWaiApp.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from file://NetworkLocation/ShareChiWaiApp.application: the manifest may not be valid or the file could not be opened.
+ Manifest XML signature is not valid.

+ No signature was present in the subject.

由於我多數發報的應用程式都是In-house使用的
所以我都用弓ClickOnce Publish的方式發報..
最後發現了…

+ Manifest XML signature is not valid.
+ No signature was present in the subject.

這兩句信息應該解釋了其中的一些問題
由於這個應用是發報在公司的網絡上所以是應該要簽署這個ClickOnce manifests
解決方法:
開啟 “My Project
之後去 Signing tab [簽署]分頁 –>如果“Sign the ClickOnce manifests” 沒有tick的話 便選擇他
你可能需要建立一個證書的  去簽署這個ClickOnce manifests
按一下 “Create Test Certificate” 之後輸入密碼便可

Sign 了這個ClickOnce manifests 得他便得到了一個
更有用的錯誤信息..
原來他的電腦沒有安裝.Net 4 Framework

所以便收到了The application is improperly formatted的錯誤了

Hope you find it useful

Leave a Reply