共用方式為


/resource (Visual Basic)

將 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)。 若要在執行階段存取其他所有資源,請使用下列其中一個方法:GetManifestResourceInfoGetManifestResourceNamesGetManifestResourceStream

/resource 的簡短形式為 /res。

如需有關如何設定資訊/resource在 Visual Studio 的 IDE 中,請參閱管理應用程式資源

範例

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

vbc /res:rf.resource in.vb

請參閱

參考

/win32resource

/linkresource (Visual Basic)

/target (Visual Basic)

編譯命令列範例 (Visual Basic)

其他資源

Visual Basic 命令列編譯器