2013-08-02 40 views
1

我有一個使用引用庫的應用程序。 該庫反過來引用.winmd庫。運行時嘗試查找exe/dll而不是.winmd引用

望着引用庫中的IL,我可以SEEE此引用:

.assembly extern windowsruntime FlurryWin8SDK 
{ 
    .ver 0:9:0:0 
} 

在運行但是,我得到一個例外:

{"Could not load file or assembly 'FlurryWin8SDK' or one of its dependencies. The system cannot find the file specified.":"FlurryWin8SDK"} 

此外,通過使用procmon中我看到有嘗試搜索FlurryWin8SDK.exe和FlurryWin8SDK.dll,但不是擴展名爲.winmd的文件。

此外,這是從融合LogViewer中輸出:

BEGIN : Framework bind. 
END : The provided identity format is not recognized. (Exception from HRESULT: 0x80132003) 
BEGIN : Windows Runtime Type bind. 
END : The provided identity format is not recognized. (Exception from HRESULT: 0x80132003) 
BEGIN : Immersive bind. 
END : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) 

有什麼能爲這種古怪的行爲的原因?

+0

您是否找到解決方案?我在WP 8.1中使用我自己的WinMD組件時遇到了非常類似的問題。 – Soonts

回答

2

這不是奇怪的行爲。 WinRT讓DLL Hell變得難以企及,這種問題你不能指望商店用戶排除故障。一個非常困難的要求是所有的依賴關係都包含在應用程序包中。而Windows只會在該DLL中查找該包。

這使得使用.winmd文件稍微有用。您只會考慮使用單獨打包的許多獨立解決方案構建的大型產品。

+0

我忘了提及,但.winmd包含在軟件包中... –

+0

.winmd文件不包含任何代碼,只是聲明。當它試圖找到代碼時,你的程序就會失敗。 –

+1

Flurry將他們的代碼放在.winmd文件中......我可以在Reflector中看到實際的代碼。 –

2

託管的WinRT類型有時可以將代碼嵌入到winmd文件中。但是,如果.net程序集包含任何不是WinRT類型的公共類型,它們將以擴展名爲.Dll的.Net程序集中。您的組件可能包含DLL中的代碼以及winmd文件。

相關問題