0
我有一個庫項目,我使用它作爲一個使用MvcContrib的可移植區域項目。如何從MvcContrib後面的代碼訪問嵌入式資源?
在Library
項目裏面,我從後面的代碼訪問本地圖像。
string imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("Controls\\images\\expander_opened_hover.png"));
using (Bitmap bmp = (Bitmap)Bitmap.FromFile(imagePath))
{
// do somthing with this image
}
的代碼運行在Library
項目,但是當我從「主機」項目訪問相同的功能,我得到該文件未找到錯誤。該文件在Library
項目中設置爲Embedded Resource
,但它在主機項目中不存在。
我該如何設置路徑,以便它可以找到嵌入的圖標?
精彩!謝謝 – Catalin