Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
条件付きコンパイルに基づいて異なる値を持つ必要がある文字列リソースがあります。
Visual Studio 2008 Professional で異なるコンパイル マクロに対して異なるリソースをセットアップする方法は?
いいえ、できません。リソース文字列は XML 形式で .resx ファイルに格納され、#ifdef は適用されません。Properties.Resources クラスは自動生成されます。Designer.cs ソース コード ファイルに配置した #ifdef は、ファイルが再生成されると失われます。
文字列を取得するコードに #ifdef を挿入します。小さな静的ヘルパー メソッドがその役割を果たします。