Tuesday, September 15, 2009

[VC++] This application has failed to start because the application configuration is incorrect

今天在上一個程式時,發生了下面這個問題。
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

從system log中查詢錯誤訊息,可以從Event ID:32跟59這兩個錯誤訊息中得知,是程式無法連結到Microsoft.VC80.CRT所導致的錯誤。這時google到最簡單的答案是,把下面兩個VC++ 2005可轉發套件裝下去就好了,結果裝了之後還是一樣的錯誤訊息,只好繼續追問題。



Microsoft Visual C++ 2005 Redistributable Package (x86)

Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)

我都只列x86的,有需要可以自己找別的版本。







這時從Event Log下手去查。(因為上面的Help and Support Center沒用)


Source:SideBySide Event ID:59
Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The referenced assembly is not installed on your system.

Source:SideBySide Event ID:32
Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced assembly is not installed on your system.

追了一陣子後,得知這是我在開發機上程式裡.manifest檔裡設定的版本與現在移植過去的環境版本不符。下面這是程式裡設定的。


<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.4053' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>

環境上的版本可以去%SYSTEM%\WinSxS\下面翻,如果翻不到就表示沒有程式裡相同版本的dll。像我的話如果版本正確,在這邊可以看到

x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989

這個資料夾(可是沒有)。於是又用關鍵字下去找,終於找到下面這個可轉發套件,裝了之後程式終於可以正常運行了 =_=



Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update

原本想說要出大絕招把檔案拷貝過來然後寫註冊檔的...



快速的英文版分隔線



If you got those errmsg like i post , you can try those 3 patch , maybe you can fix it :)
1)Microsoft Visual C++ 2005 Redistributable Package (x86)
2)Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)
3)Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update

No comments:

Post a Comment