-resource (Visual Basic)

將 Managed 資源內嵌至組件中。

語法

-resource:filename[,identifier[,public|private]]  

-res:filename[,identifier[,public|private]]  

引數

詞彙 定義
filename 必要。 要內嵌在輸出檔中的資源檔名稱。 根據預設,filename 在組件中為公用。 如果檔案名稱包含空格,請用引號 (" ") 括住名稱。
identifier 選擇性。 資源的邏輯名稱;用來載入資源的名稱。 預設值是檔案的名稱。 您可以選擇性地指定資源是否為資訊清單中的公用或私用,如下所示:-res:filename.res, myname.res, public

備註

使用 -linkresource 將資源連結至組件,而不將資源檔放在輸出檔中。

例如,如果 filename 是由 Resgen.exe (資源檔產生器) 或是在開發環境中所建立的 .NET Framework 資源檔,就可以使用 System.Resources 命名空間中的成員進行存取 (請參閱 ResourceManager 以取得詳細資訊)。 若要在執行階段存取所有其他資源,請使用下列其中一種方法:GetManifestResourceInfoGetManifestResourceNamesGetManifestResourceStream

-resource 的簡短形式為 -res

如需如何在 Visual Studio IDE 中設定 -resource 的資訊,請參閱管理應用程式資源 (.NET)

範例

下列程式碼會編譯 In.vb 並附加資源檔 Rf.resource

vbc -res:rf.resource in.vb  

另請參閱