2017-03-21 81 views
1

我有一臺安裝Windows 7的機器,我想安裝我的應用程序。Clickonce WPF Windows 7 - 應用程序格式不正確。

我已經建立了一個WPF應用程序在Windows 10的.NET 4.5先決條件和Visual C++ Redistributable Packages for Visual Studio 2013

我已經包括了他們在我的ClickOnce安裝程序的先決條件:

enter image description here

enter image description here

如果我試圖運行在Windows 7機器上從Clickonce生成的.application文件,我會得到以下內容摹錯誤:

Cannot Continue. The application is improperly formatted. Contact the application vendor for assistance.

不過,我在我的Windows 7計算機上運行setup.exe它正確的提示,它需要安裝.NET 4.5Visual C++ Redistributable Packages for Visual Studio 2013。然後成功完成每個先決條件的安裝過程。

除安裝了先決條件之後,我收到了與上面相同的The application is improperly formatted.錯誤。

如果我然後重新運行.application文件,它將最終安裝。

無論哪種方式,這絕對不是一個好的用戶體驗。這與在Windows 10上構建應用程序並嘗試在Windows 7上安裝有關嗎?

我已經看到了這個問題,這似乎是相似的,但我作爲一個先決條件安裝.NET 4.5:

Manifest may not be valid or the file could not be opened.

下面是錯誤的詳細信息:

PLATFORM VERSION INFO 
    Windows    : 6.1.7601.65536 (Win32NT) 
    Common Language Runtime  : 2.0.50727.5420 
    System.Deployment.dll  : 2.0.50727.5420 (Win7SP1.050727-5400) 
    mscorwks.dll   : 2.0.50727.5420 (Win7SP1.050727-5400) 
    dfdll.dll   : 2.0.50727.4927 (NetFXspW7.050727-4900) 
    dfshim.dll   : 4.0.40305.0 (Main.040305-0000) 

SOURCES 
    Deployment url   : file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application 

ERROR SUMMARY 
    Below is a summary of the errors, details of these errors are listed later in the log. 
    * Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application resulted in exception. Following failure messages were detected: 
     + Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened. 
     + Manifest XML signature is not valid. 
     + SignatureDescription could not be created for the signature algorithm supplied. 

COMPONENT STORE TRANSACTION FAILURE SUMMARY 
    No transaction error was detected. 

WARNINGS 
    There were no warnings during this operation. 

OPERATION PROGRESS STATUS 
    * [3/21/2017 4:20:01 PM] : Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application has started. 

ERROR DETAILS 
    Following errors were detected during this operation. 
    * [3/21/2017 4:20:01 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse) 
     - Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened. 
     - Source: System.Deployment 
     - Stack trace: 
      at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri) 
      at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation) 
      at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options) 
      at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) 
      at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state) 
     --- Inner Exception --- 
     System.Deployment.Application.InvalidDeploymentException (SignatureValidation) 
     - Manifest XML signature is not valid. 
     - Source: System.Deployment 
     - Stack trace: 
      at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s) 
      at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri) 
     --- Inner Exception --- 
     System.Security.Cryptography.CryptographicException 
     - SignatureDescription could not be created for the signature algorithm supplied. 
     - Source: System.Security 
     - Stack trace: 
      at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key) 
      at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey) 
      at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags) 
      at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s) 

COMPONENT STORE TRANSACTION DETAILS 
    No transaction information is available. 

回答

0

你的清單是使用SHA-256進行簽名。當您嘗試在僅安裝了.NET 4.0的計算機上安裝ClickOnce應用程序時,您會收到您提到的Manifest XML signature is not valid錯誤,因爲預計會高達.NET 4.0 SHA-1。

這就是爲什麼在成功安裝.NET 4.5之前,先決條件一切正常。我不知道爲什麼這不是一步工作,而是需要兩個步驟。也許這與安裝新的框架版本後需要重新啓動有關?

解決方案是在簽署清單時使用SHA-1。您可以在this answer from Miroslav Nedyalkov中找到有關如何達到此目的的信息。

相關問題