ResGen.exe - リソース ファイル ジェネレータ




resgen [parameters] [/compile]filename.extension [outputFilename.extension] [/str:lang[,namespace[,class[,file]]]]

filename.extension 指定

input ↓ .txt.resx.resource<-output
.txt - 省略可 string resource only in text file
.resx - 省略可 XML ベースのリソース ファイル
.resource - リソース ファイル


/compile

複数の .resx ファイルまたは .txt ファイルを指定して、一括した操作で .resources ファイルに変換できるようにします。このオプションを指定しない場合、指定できる入力ファイル引数は 1 つだけです。

/publicClass

厳密に型指定されたリソース クラスをパブリック クラスとして作成します。

/str: オプションを使用しない場合、このオプションは無視されます。

/r: assembly

型が assembly から読み込まれることを指定します。このオプションを指定すると、以前のバージョンの .resx ファイルの型は assembly の型を使用します。

/str: language[,namespace[,classname[,filename]]]

厳密に型指定されたリソース クラス ファイルを、language オプションで指定されているプログラミング言語 (C# または Visual Basic) で作成します。namespace オプションを使用してプロジェクトの既定の名前空間を指定したり、classname オプションを使用して生成されるクラスの名前を指定したり、filename オプションを使用してクラス ファイルの名前を指定したりできます。

/usesourcepath

入力ファイルの現在のディレクトリを使用して相対ファイル パスを解決することを指定します。



テキスト ファイル .txt

;comments

  • テキスト ファイルにコメントを含める
  • コメントの前には、セミコロンまたはシャープ記号 (#) を付ける
  • コメントは、.txt ファイルを .resources ファイルに変換するときに失われる

name = value

  • 文字列リソースは、名前と値のペア エントリとして指定する
  • 名前はリソースを説明する文字列
  • 値は ResourceManager.GetString メソッドによって名前を取得したときに返されるリソース文字列
  • 名前と値は等号 (=) で区切る
  • Msg1 = Hello, and Welcome!
  • 値には改行文字を含められない
  • C 言語形式のエスケープ文字で、改行を表す \n やタブを表す \t などを使用できる
  • 空の文字列を使用できる
  • MyEmptyString=


.resx リソース ファイル形式


.resources ファイル  (複数形の s に注意)






$ resgen
Microsoft (R) .NET Resource Generator
[Microsoft .Net Framework, Version 2.0.50727.312]
Copyright (c) Microsoft Corporation.  All rights reserved.

Usage:
   ResGen inputFile.ext [outputFile.ext] [/str:lang[,namespace[,class[,file]]]]
   ResGen [options] /compile inputFile1.ext[,outputFile1.resources] [...]

Where .ext is .resX, .restext, .txt, or .resources

Converts files from one resource format to another.  If the output
filename is not specified, inputFile.resources will be used.
Options:
/compile        Converts a list of resource files from one format to another
                in one bulk operation.  By default, it converts into .resources
                files, using inputFile[i].resources for the output file name.
/str:<language>[,<namespace>[,<class name>[,<file name>]
]]]
                Creates a strongly-typed resource class in the specified
                programming language using CodeDOM. In order for the strongly
                typed resource class to work properly, the name of your output
                file without the .resources must match the
                [namespace.]classname of your strongly typed resource class.
                You may need to rename your output file before using it or
                embedding it into an assembly.
/useSourcePath  Use each source file's directory as the current directory
                for resolving relative file paths.
/publicClass    Create the strongly typed resource class as a public class.
                This option is ignored if the /str: option is not used.
/r:<assembly>   Load types from these assemblies. A ResX file with a previ
ous
                version of a type will use the one in this assembly, when set.

.txt files have this format:

    # Use # at the beginning of a line for a comment character.
    name=value
    more elaborate name=value

Language names valid for the /str:<language> option are:
c#, cs, csharp, vb, vbs, visualbasic, vbscript, js, jscript, javascript, vj#, vj

s, vjsharp, c++, mc, cpp



al /out:WorldCalc.Resources.DLL /embed:MyStrings.resources,MyStrings.resources,Private

/embed パラメータの構文
	/embed:<filename>[,<name>[,Private]
<filename>- .resources ファイルの名前です。
<name> - リソースの内部名です。通常は ResourceManager を構築するときに使われ ます。一般には名前空間が含まれます。
Private - リソースが他のアセンブリから参照できるかどうかを指定します (既定値は no です)。


reference