0
我在我的類庫的View/Images文件夾中有圖像。我試圖將其構建操作設置爲資源和嵌入式資源,但它們沒有打包到類庫dll中。我怎樣才能做到這一點?如何將圖像打包到DLL中的C#
我在我的類庫的View/Images文件夾中有圖像。我試圖將其構建操作設置爲資源和嵌入式資源,但它們沒有打包到類庫dll中。我怎樣才能做到這一點?如何將圖像打包到DLL中的C#
正如禮提到的,設置生成操作嵌入的資源爲所有images.I使用了下面的代碼片段來檢查圖像是否被裝入DLL或not.I我能得到的所有圖像
protected void btnGetImages_Click(object sender, EventArgs e)
{
Assembly currentAssembly = Assembly.GetExecutingAssembly();
string[] resources = currentAssembly.GetManifestResourceNames();
foreach(string resource in resources)
{
Response.Write(resource + "<br/>");
}
}
在'WPF'中,您應該將構建操作設置爲'Resource' –
對於這種情況,理想的IMO構建操作應該是Content。特別是圖片。它們作爲內容加載得比嵌入式資源更快。 – niksofteng