2013-05-07 6 views
1

두 개의 큰 리소스 파일이 있는데이를 병합해야합니다. 두 파일에서 동일한 이름 속성이있을 수 있습니다.두 개의 Visual Studio .resx 파일을 병합하십시오.

<data name="SomeResource" xml:space="preserve"> 
    <value> The resource value </value> 
</data> 

동일한 모든 자원 이름을 얻는 방법은 무엇입니까? 동일한 값을 가진 항목이 있으면 문제가되지 않지만 동일한 이름이 문제입니다.

+0

는 일부 파일 비교 소프트웨어와 봤어을 .. 그들은 당신이 일치하는 정확한 라인을 알려 드리겠습니다 .. –

+0

는 봐 이 기사 (http://www.codeproject.com/Articles/37022/Solving-the-resx-Merge-Problem). 도움이 될지도 모릅니다. – HuorSwords

답변

3

당신은 모든 중복 된 자원 이름 얻을 수있는 작은 콘솔 응용 프로그램을 사용할 수 있습니다

using System; 
using System.Collections; 
using System.Globalization; 
using System.Linq; 

class Program 
{ 
    static void Main(string[] args) 
    { 
     //replace with your strongly typed resource classes 
     var rm1 = MyApplication.Properties.Resources.ResourceManager; 
     var rm2 = MyApplication.Properties.Resources1.ResourceManager; 

     var rs1 = rm1.GetResourceSet(CultureInfo.CurrentUICulture, true, true); 
     var rs2 = rm2.GetResourceSet(CultureInfo.CurrentUICulture, true, true); 

     var result = from re1 in rs1.Cast<DictionaryEntry>() 
        join re2 in rs2.Cast<DictionaryEntry>() 
         on re1.Key equals re2.Key 
        select new { re1, re2 }; 

     foreach (var item in result) 
     { 
      Console.Write("Key with name \"{0}\" is present in ", 
       item.re1.Key); 
      Console.WriteLine("both files (\"{0}\" and \"{1}\")", 
       item.re1.Value, item.re2.Value); 
     } 
    } 
} 
관련 문제