網站下載程式碼後無法編譯

CodePlex下載SourceCode回家玩,Build時卻發生錯誤:

The "ValidateXaml" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\WorkRoom\WP7\3rdParty\PhoneControls\Phone.Controls.Samples.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\WorkRoom\WP7\3rdParty\PhoneControls\Phone.Controls.Samples.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

由訊息研判,發生錯誤的原因是Phone.Controls.Samples.dll來自網路下載,故不被信任。(事實上這個dll是從下載的ZIP檔解壓縮取出的,沒想到.NET Framework/Windows 7這麼精,沒有良民證的事還是一下就被揪出來 XD)

解法很簡單,用檔案總管將DLL上的封印解除即可: (Unblock的技巧先前有介紹過)

【延伸閱讀】

MSDN: How to: Use an Assembly from the Web in Visual Studio

PS: MSDN的社群註解(Community Content)功能挺不賴的,在其中看到一則網友回饋的小提示: 下載包含DLL的ZIP檔時,先將ZIP Unblock,就不需要解出一堆DLL再一一Unblock囉!

歡迎推文分享:
Published 15 August 2010 03:58 PM 由 Jeffrey
Filed under: , ,
Views: 7,968



意見

沒有意見

你的看法呢?

(必要的) 
(必要的) 
(選擇性的)
(必要的) 
(提醒: 因快取機制,您的留言幾分鐘後才會顯示在網站,請耐心稍候)

5 + 3 =

搜尋

Go

<August 2010>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234
 
RSS
創用 CC 授權條款
【廣告】
twMVC

Tags 分類檢視
關於作者

一個醉心技術又酷愛分享的Coding魔人,十年的IT職場生涯,寫過系統、管過專案, 也帶過團隊,最後還是無怨無悔地選擇了技術鑽研這條路,近年來則以做一個"有為的中年人"自許。

文章典藏
其他功能

這個部落格


Syndication