2012-06-04 3 views
0

모든 스크립트를 하나로 결합하려고합니다. 기본 폴더 'scripts'와 다른 'scripts/other'라는 두 개의 폴더가 있습니다.ScriptBundle은 주문에 따라 다른 스크립트를 포함하지 않습니다.

내가하려고하면 '스크립트/기타'에 포함되지 않습니다에서

BundleTable.Bundles.Add(new ScriptBundle("~/scripts/all").Include("~/Scripts/*.js", "~/Scripts/other/*.js")); 

스크립트. 하지만 순서를 뒤집을 때 :

BundleTable.Bundles.Add(new ScriptBundle("~/scripts/all").Include("~/Scripts/other/*.js", "~/Scripts/*.js")); 

작동합니다 !! 누군가가 왜 그런지 말할 수 있습니까?

+0

나에게 repro을 보낼 수 있습니까? – RickAndMSFT

+0

이 프로젝트를 찾으려고합니다. – MuriloKunze

답변

1

내가 무슨 일이 일어나고 있는지 모르겠지만, 이것은 System.Web.Optimization.Bundle 내부 코드 :

// System.Web.Optimization.Bundle 
public Bundle Include(params string[] virtualPaths) 
{ 
    for (int i = 0; i < virtualPaths.Length; i++) 
    { 
     string text = virtualPaths[i]; 
     Exception ex = Bundle.ValidateVirtualPath(text, "virtualPaths"); 
     if (ex != null) 
     { 
      throw ex; 
     } 
     if (text.Contains('*')) 
     { 
      int num = text.LastIndexOf('/'); 
      string text2 = text.Substring(0, num); 
      if (text2.Contains('*')) 
      { 
       throw new  ArgumentException(string.Format(CultureInfo.CurrentCulture,  OptimizationResources.InvalidPattern, new object[] 
       { 
       text 
      }), "virtualPaths"); 
     } 
     string text3 = ""; 
     if (num < text.Length - 1) 
     { 
      text3 = text.Substring(num + 1); 
     } 
     PatternType patternType = PatternHelper.GetPatternType(text3); 
     ex = PatternHelper.ValidatePattern(patternType, text3, "virtualPaths"); 
     if (ex != null) 
     { 
      throw ex; 
     } 
     this.IncludeDirectory(text2, text3); 
    } 
    else 
    { 
     this.IncludeFile(text); 
    } 
} 
return this; 
} 
5

당신이 동일한 보면 직접 IncludeDirectory 메소드를 호출하고보고 사용해 볼 수 발행물?

ScriptBundle("~/scripts/all").IncludeDirectory("~/Scripts", "*.js").IncludeDirectory("~/Scripts/other", "*.js")); 

이것이 작동하는 경우 여기에 버그가있을 수 있습니다.

관련 문제