2012-06-23 56 views
3

我使用Visual Studio 2010和VB.NET。我的目標環境是.NET Framework 4.0。發佈的ClickOnce安裝錯誤「異常讀數從清單」使用VB.NET

所以,當我使用提供Setup.exe文件發佈項目中,我要面對這個問題。在驗證應用需求彈出後,警報彈出文本:

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

當我點擊「詳細信息」按鈕,這表明我這個錯誤:

PLATFORM VERSION INFO 
Windows     : 6.1.7601.65536 (Win32NT) 
Common Language Runtime : 4.0.30319.239 
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100) 
clr.dll     : 4.0.30319.239 (RTMGDR.030319-2300) 
dfdll.dll    : 4.0.30319.1 (RTMRel.030319-0100) 
dfshim.dll    : 4.0.31106.0 (Main.031106-0000) 

SOURCES 
Deployment URL   : file:///I:/ProjectBMTRelease/ProjectBMT.application 

IDENTITIES 
Deployment Identity  : ProjectBMT.application, Version=1.0.0.6, Culture=neutral, PublicKeyToken=7439f62500c0364d, processorArchitecture=x86 

APPLICATION SUMMARY 
* Installable application. 

ERROR SUMMARY 
Below is a summary of the errors, details of these errors are listed later in the log. 
* Activation of I:\ProjectBMTRelease\ProjectBMT.application resulted in exception. Following failure messages were detected: 
    + Exception reading manifest from file:///I:/ProjectBMTRelease/Application%20Files/ProjectBMT_1_0_0_6/ProjectBMT.exe.manifest: the manifest may not be valid or the file could not be opened. 
    + Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed: 
     -HRESULT:  0x80070c81 
     Start line: 0 
     Start column: 0 
     Host file: 
    + Exception from HRESULT: 0x80070C81 

COMPONENT STORE TRANSACTION FAILURE SUMMARY 
No transaction error was detected. 

WARNINGS 
There were no warnings during this operation. 

OPERATION PROGRESS STATUS 
* [6/23/2012 5:21:36 PM] : Activation of I:\ProjectBMTRelease\ProjectBMT.application has started. 
* [6/23/2012 5:21:36 PM] : Processing of deployment manifest has successfully completed. 
* [6/23/2012 5:21:36 PM] : Installation of the application has started. 

ERROR DETAILS 
Following errors were detected during this operation. 
* [6/23/2012 5:21:36 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse) 
    - Exception reading manifest from file:///I:/ProjectBMTRelease/Application%20Files/ProjectBMT_1_0_0_6/ProjectBMT.exe.manifest: 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.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath) 
     at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp) 
     at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc) 
     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 (ManifestParse) 
    - Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed: 
     -HRESULT:  0x80070c81 
     Start line: 0 
     Start column: 0 
     Host file: 
    - Source: System.Deployment 
    - Stack trace: 
     at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream) 
     at System.Deployment.Application.Manifest.AssemblyManifest..ctor(FileStream fileStream) 
     at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri) 
    --- Inner Exception --- 
    System.Runtime.InteropServices.COMException 
    - Exception from HRESULT: 0x80070C81 
    - Source: System.Deployment 
    - Stack trace: 
     at System.Deployment.Internal.Isolation.IsolationInterop.CreateCMSFromXml(Byte[] buffer, UInt32 bufferSize, IManifestParseErrorCallback Callback, Guid& riid) 
     at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream) 

COMPONENT STORE TRANSACTION DETAILS 
No transaction information is available. 

我檢查我的項目的清單文件,但我不夠好,在那裏找到任何問題。對於其他信息,我創建了簡單的「Hello World!」應用程序看它是否會很好地發佈,並且它確實發佈了。

解決方案是什麼?

回答

2

檢查以下內容:

  • 是否有用戶.NET 4的計算機上安裝?

  • 你是如何發佈的應用程序,您使用的Visual Studio?

  • 你發佈之後作出的部署中的任何改變?

  • 如果手動移動文件到部署位置,是結構上與原有的結構?

嘗試啓用詳細日誌記錄並查看是否提供了更多信息。 文章Enhanced Logging in ClickOnce Deployment向您展示瞭如何做到這一點。

+0

我在安裝.NET 4應用程序的.Net 4客戶端PC上沒有看到任何增強日誌。我正在嘗試診斷'應用程序格式不正確'錯誤,所以也許記錄只會在清單被驗證並且安裝開始時纔會啓動(?) – redcalx

+0

您確定您正在設置日誌文件的路徑到用戶可以寫入的路徑?一定要把它放在mydocuments或類似的東西中,而不是放在c:\ somefolder中。 – RobinDotNet

+0

實際上,當您在安裝時發生問題時單擊該按鈕以提供更多信息時,會爲您打開日誌文件。我沒有意識到這個信息是一回事。 – redcalx

1

我得到了這個非常相同的錯誤。重命名我的程序集屬性下的第一個選項卡上的程序集名稱後,問題得到解決。似乎有一個帶有空格的程序集名稱會創建一個帶有空格的清單文件名,它似乎會產生問題。我的應用程序程序集名稱被命名爲「Capital Manager」。在我將它改爲「Capital_Manager」(我將空格替換爲「_」)後,問題得到解決。

1

我試圖運行的ClickOnce安裝程序時收到錯誤報告,並調用堆棧幾乎等同於你的。到目前爲止,我的調查結果可能對其他人有所幫助,所以我會公佈詳細信息,但我有一種感覺,同樣的錯誤報告可能是由一系列不同的問題引起的。

我注意到的第一件事是,我的應用程序清單(一,列出所有的文件,爲應用+爲每一個簽名中的散列)已經爲組件條目具有無效的公鑰,例如,

<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"> 
    <asmv1:assemblyIdentity name="foo.exe" version="1.2.3.4" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" /> 

再往下的文件而不是看到dependentAssembly元件,用於組件的一些組件被列爲普通內容文件(文件元件)。

這些問題肯定會使ClickOnce部署無效,原因是使用Mage的版本,該版本是針對舊版本.NET編譯的,而不是它正試圖爲其創建清單的程序集。當創建應用程序清單法師將嘗試讀取組件如下:

AssemblyIdentity.FromFile(fileName); 

而對於法師編譯針對.NET 3.5(CLR 2.0)試圖加載在BadImageFormatException異常的.NET 4.0組件結果被處理,而回退行爲是將這些文件視爲內容文件。

1

您的應用程序文件夾是否有子文件夾?我昨天才得到這個相同的HRESULT,根本原因是一個庫(EntityFramework.dll)在頂層和子文件夾中。 (這是一個關於MAGE的警告,但沒有作爲錯誤處理。)我更新了我的腳本以從子文件夾中刪除EntityFramework.dll,現在ClickOnce已經很好了。

相關問題