2011-12-09 39 views
2

在C#.Net中創建資源文件時.... Visual Studio會自動爲該文件生成設計器代碼。默認情況下,ResourceManager類使用項目的默認命名空間實例化。 例C#.Net自動資源文件設計器代碼生成

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 
     internal static global::System.Resources.ResourceManager ResourceManager { 
      get { 
       if (object.ReferenceEquals(resourceMan, null)) { 
        global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ISC.Core.UI.DeployResources", typeof(DeployResources).Assembly); 
        resourceMan = temp; 
       } 
       return resourceMan; 
      } 
     } 

我想這個資源文件是一個自定義命名空間下(說Custom.Default.DeployResources),而不是在項目的默認命名空間(在這種情況下是「ISC.Core.UI. DeployResources「) 有沒有辦法做到這一點?

回答

2

右鍵單擊您的resx,然後在自定義工具命名空間中鍵入您的名稱空間。

您還可以將訪問修飾符從內部更改爲公共(在設計器中打開時位於resx頂部),並將資源置於外部組合件中。

1

您可以使用該默認名稱空間創建單獨的項目,專門用於資源嗎?

+0

我曾考慮過這個解決方案......但是我不希望資源文件在單獨的程序集中......但是,這可能是一個解決方案.... – sundeep