起因
前兩天寫了個小工具,在我的機器跑得好好的,QA的測試機里面卻死活跑不起來,一運行就出現一個聖誕框,報一個side by side的錯誤:
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
郁悶至極,不過這個對話框卻提供了一點額外的信息:
use the command-line sxstrace.exe tool for more detail
於是Google了一下,sxstrace.exe是一個跟蹤調試應用程序的工具,看起來很不錯的樣子。
解決過程
按照 這個 帖子,先打開sxstrace.exe的調試模式:
sxstrace trace -logfile:C:/trace.bin
然后再打開應用程序,這時候在C盤根目錄的trace.bin已經生成了,於是退出sxstrace,再運行以下命令:
sxstrace parse -logfile:C:/trace.bin -outfile:C:/trace.log
因為sxstrace trace出來的文件是二進制的,所以用上述命令將其轉換成txt的。
打開trace.log,內容如下:
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = Wow32
CultureFallBacks = en-US;en
ManifestPath = C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\installer.exe
AssemblyDirectory = C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\
Application Config File =
-----------------
INFO: Parsing Manifest File C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\installer.exe.
INFO: Manifest Definition Identity is (null).
INFO: Reference: Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
INFO: Resolving reference for ProcessorArchitecture WOW64.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: No publisher policy found.
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.DLL.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
INFO: Resolving reference for ProcessorArchitecture x86.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: No publisher policy found.
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.DLL.
INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT.DLL.
INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT.MANIFEST.
INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT\Microsoft.VC90.CRT.DLL.
INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT\Microsoft.VC90.CRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.
看起來是 Microsoft.VC90.CRT.dll 這個reference沒有找到,這個是屬於 Visual C++ 2008 Redistributable 的一個動態鏈接庫。去M$的網站下一個裝上,一切就OK了。
總結
對於windows我一向沒有好感,不評價,寫這篇blog主要是為了記錄 sxstrace.exe 這個 工具,感覺用來debug不錯。
