2011-12-13 94 views
5

我創建了一個簡單的Winforms應用程序和一個自定義安裝程序。這一切似乎很簡單,但我在事件日誌中獲得以下彈出和錯誤的詳細信息。在Visual Studio 2008中使用自定義安裝程序的錯誤1001

Error message box displayed before running the custom action code

The description for Event ID 11001 from source MsiInstaller cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Product: Custom Action Tester -- Error 1001. Error 1001. Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\system32\Action' or one of its dependencies. The system cannot find the file specified.. (NULL) (NULL) (NULL) (NULL) (NULL)

the message resource is present but the message is not found in the string/message table

我已經檢查C:\ Windows \ System32下,並沒有文件或文件夾名爲動作,但有3個文件名爲ActionCenter.dllActionCenterCPL.dllActionQueue .dll

任何想法如何解決此錯誤?

編輯:

科斯明 - pirvu的建議,我跑了記錄安裝程序。下面顯示了出現錯誤的區域,但我仍然不知道如何解決問題。

MSI (s) (40:7C) [09:34:26:523]: Executing op: CustomActionSchedule(Action=_FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install,ActionType=3073,Source=BinaryData,Target=ManagedInstall,CustomActionData=/installtype=notransaction /action=install /LogFile= /targetdir="C:\Test\Custom Action Tester\" /Param1="C:\Test\TestFile.txt" /Param2="C:\Test\" "C:\Test\Custom Action Tester\ConfigSetup.dll" "C:\Users\wildb\AppData\Local\Temp\CFG66BE.tmp") 
MSI (s) (40:94) [09:34:26:525]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI85A8.tmp, Entrypoint: ManagedInstall 
MSI (s) (40:F0) [09:34:26:525]: Generating random cookie. 
MSI (s) (40:F0) [09:34:26:557]: Created Custom Action Server with PID 6492 (0x195C). 
MSI (s) (40:D4) [09:34:26:586]: Running as a service. 
MSI (s) (40:D4) [09:34:26:587]: Hello, I'm your 32bit Elevated custom action server. 
DEBUG: Error 2835: The control ErrorIcon was not found on dialog ErrorDialog 
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDialog, 
Error 1001. Error 1001. Exception occurred while initializing the installation: 
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\system32\Action' or one of its dependencies. The system cannot find the file specified.. 
MSI (s) (40!4C) [09:34:29:580]: 
MSI (s) (40:94) [09:34:29:584]: Leaked MSIHANDLE (14) of type 790531 for thread 7244 
MSI (s) (40:94) [09:34:29:584]: Note: 1: 2769 2: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install 3: 1 
DEBUG: Error 2769: Custom Action _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install did not close 1 MSIHANDLEs. 
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install, 1, 
CustomAction _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) 
Action ended 09:34:29: InstallExecute. Return value 3. 

這應該是一個快速的勝利,讓我們的用戶生活更簡單;他們不想編輯配置文件......但它變成了一個噩夢。 :O(

編輯2:

大量的玩耍後,當在圖中所示的自定義操作中指定的參數錯誤只提出了自己的問題是,自定義安裝程序。無用而不能讀取在前面的安裝屏幕中輸入的值。

Custom action property screen

+1

嘗試創建詳細的安裝日誌以查看觸發錯誤的原因:http://setupanddeployment.com/debugging/msi-log。您可以在日誌中搜索「返回值3」。 –

回答

6

兜兜轉轉幾個小時後,我終於找到了問題,更重要的是,該解決方案。

應該可以傳遞參數「CustomActionData」定義on this blog但參數是有點querky,至少可以說...

我發現文本參數不能有周圍的參數報價名稱,應該採用以下格式:

/Param1=[CONFIG_TESTFILE] /Param2=[CONFIG_TESTFOLDER]

此外,使用您需要包含引號,但不是用反斜槓結束領域的目標目錄參數,你必須使用一個空格來代替,這樣:

/target="[TARGETDIR] "

+3

我會建議使用「\」而不是目標空間。您可以輕鬆使用此代碼來獲取正確的路徑:string exePath = Path.Combine(Context.Parameters [「targetdir」],「TestForSetup.exe」); var config = ConfigurationManager.OpenExeConfiguration(exePath); –

+1

謝謝,這真讓我難過。最後一部分真的很奇怪。 – Jens

+0

@Stef即使尾隨「\」,也必須添加一個額外的空間才能使安裝程序正常工作。 (如果沒有空間,我的安裝程序會成功安裝我的軟件,但卸載失敗會顯示上述消息。)看起來這是因爲安裝程序將結尾「\」視爲結尾雙引號(「)的轉義字符。因此,您必須在兩者之間插入一個空格。 –

相關問題