SilverLight項目編譯錯誤提示未載入System.Windows

來源:互聯網
上載者:User

初學SilverLight遇到如下錯誤提示的問題,糾結很久,終於搞定了,差點讓重裝Visual Studio;記錄一下以示慶祝。錯誤資訊為:

無法解析引用程式集。請檢查引用程式集。未能負載檔案或程式集“System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e”或它的某一個依賴項。系統找不到指定的檔案。 

到Silverlight安裝目錄下找到 X:\Program Files (x86)\Microsoft Silverlight\4.1.10111.0\System.Windows.dll

調用gacutil.exe將其加入到全域組件快取即可。如果還不對的話,把 System.Core.dll 也一起加入到緩衝。(請視SilverLight具體版本修改)

我比較懶,具體做法是執行下面的批次檔(存為bat檔案,具體路徑視情況修改):

@SET GACUTIL="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe"
Echo Install the dll into GAC
%GACUTIL% -if "C:\Program Files (x86)\Microsoft Silverlight\4.1.10111.0\System.Core.dll"
%GACUTIL% -if "C:\Program Files (x86)\Microsoft Silverlight\4.1.10111.0\System.Windows.dll"

pause

補充說明一下,在百度上搜尋很久、很多次沒有找到合適的回答;最後在google終於找到解答,詳細可查看網文

http://www.nivisec.com/2009/06/could-not-load-file-or-assembly.html

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.