ClickOnce: 部署識別與訂閱不符
0 |
手邊有個使用ClickOnce的專案交給了同事維護及部署,順利編譯完成並部署新版後,用戶端測試自動更新失敗,並可由Log看到以下訊息:
System.Deployment.Application.DeploymentException (SubscriptionState)
- 部署識別與訂閱不符。(英文版為: The deployment identity does not match the subscription.)
- 來源: System.Deployment
- 堆疊追蹤:
於 System.Deployment.Application.SubscriptionStore.CheckUpdateInManifest(SubscriptionState subState, Uri updateCodebaseUri, AssemblyManifest deployment, Version currentVersion)
於 System.Deployment.Application.ApplicationActivator.PerformDeploymentUpdate(SubscriptionState& subState, String& errorPageUrl)
於 System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
於 System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
於 System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
之前遇過一次,原本的測試用簽章憑證過期(預設期限只有一年,真短),換掉憑證就發生類似慘劇,只得請User移除重裝。有了上回的經驗,這回將程式換到同事開發環境時,已特別確認過用的簽章憑證是同一個,怎麼還發生同樣問題?
花了點功夫,找出錯誤訊息的原文是The deployment identity does not match the subscription,接著就Google到重要情資。原來,所謂的Deployment Identity包含了Name、Version、Culture、Public Key Token以及Processor Architecture五個部分。而在MyAppName.appcation中可以找到如下記錄:
<assemblyIdentity name="MyAppName.exe" version="1.0.1234.99" publicKeyToken="aeef5d24f8dc7d79" language="neutral" processorArchitecture="x86" type="win32" />
比對新舊版本MyAppName.application,真相大白! 發現我Project Build設定的Platform Target設定了x86,而同事則是Any CPU,產生的MyAppName.application processorArchitecture不同,分別為x86及msil,這個差異讓ClickOnce的自動更新機制認定新版與原先我部署的舊版不相容,導致上述錯誤。
知道了原因,一切好說,請同事將Platform Target也改成x86,問題解決!
PS: 由找到的資料,意外還發現另一件事!! 其實,即使換了憑證,還是可以保持相容的,方法是確認deploymentProvider的URI相同,assemblyIdentity的name, language, processorArchitecture相同,如此ClickOnce會認定新舊版仍保持相容。
Comments
Be the first to post a comment