/resource (Visual Basic)
更新:2007 年 11 月
將 Managed 資源嵌入至組件。
/resource:filename[,identifier[,public|private]]
' -or-
/res:filename[,identifier[,public|private]]
引數
filename
必要項。要內嵌至輸出檔的資源檔名稱。依預設,filename 在組件中是公用的。如果檔案名稱包含空格,請加上英文雙引號 (" ")。identifier
選擇項。資源的邏輯名稱;用來載入資源的名稱。預設值是檔案的名稱。或者,您可以在組件資訊清單中指定資源是公用的 (Public) 或私用的 (Private),方法如下所示:/res:filename.res、myname.res、public
備註
請使用 /linkresource 將資源連結至組件,而非將資源檔置於輸出檔中。
如果 filename 是由 資源檔產生器 (Resgen.exe) 或在開發環境中所建立的 .NET Framework 資源檔,則可以使用 System.Resources 命名空間 (Namespace) 內的成員來存取 (如需詳細資訊,請參閱 ResourceManager)。若要在執行階段存取其他所有資源,請使用下列其中一個方法:GetManifestResourceInfo、GetManifestResourceNames 或 GetManifestResourceStream。
/resource 的簡短形式為 /res。
若要在 Visual Studio 整合式開發環境中設定 /resource
- 請參閱 專案設計工具、資源頁。
範例
下列程式碼會編譯 In.vb,並附加資源檔 Rf.resource。
vbc /res:rf.resource in.vb