Я пытаюсь использовать YUICompressor.NET в своем проекте. Это веб-проект asp.net mvc, framework 4.5.1.YUICompressor.NET Метод не найден ICompressor.get_ContentType() error
Я получаю эту ошибку:
Method not found: 'System.String Yahoo.Yui.Compressor.ICompressor.get_ContentType()'.
на:
Line 6: <title>@ViewBag.Title - My ASP.NET Application</title>
Line 7: @Styles.Render("~/Content/css")
Line 8: @Scripts.Render("~/bundles/modernizr")
Line 9:
Кто-нибудь есть идеи?
Я следовал инструкциям в этом видео (https://www.youtube.com/watch?v=NSHGSbViMm8) и изменил содержание метода RegisterBundles следующим образом:
var javascriptConfig = new JavaScriptCompressorConfig();
var javascriptTransform = new YuiCompressorTransform(javascriptConfig);
bundles.Add(new Bundle("~/bundles/jquery", javascriptTransform).Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new Bundle("~/bundles/jqueryval", javascriptTransform).Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new Bundle("~/bundles/modernizr", javascriptTransform).Include(
"~/Scripts/modernizr-*"));
bundles.Add(new Bundle("~/bundles/bootstrap", javascriptTransform).Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
Вот трассировки стека:
[MissingMethodException: Метод не найдено: «System.String Yahoo.Yui.Compressor.ICompressor.get_ContentType() '.] Yahoo.Yui.Compressor.Web.Optimization.YuiCompressorTransform.Process (BundleContext context, BundleResponse response) +0 System.Web.Optimization.Bundle.ApplyTransforms (BundleContext context , String bundleContent, IEnumerable 1 bundleFiles) +273 System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +141 System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +45 System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +166 System.Web.Optimization.AssetManager.EliminateDuplicatesAndResolveUrls(IEnumerable
1 refs) +296 System.Web.Optimization.AssetManager.DeterminePathsToRender (IEnumerable`1 assets) +733 System.Web.Optimization.AssetManager.RenderExplicit (String tagFormat, String [] paths) +35 System.Web. Optimization.Scripts.RenderFormat (String tagFormat, String [] paths) +105 System.Web.Optimization.Scripts.Render (String [] paths) +21 ASP._Page_Views_Shared__Layout_cshtml.Execute() в c: \ Users \ Entegral \ Документы \ Visual Studio 2013 \ Projects \ WebApplication4 \ WebApplication4 \ Views \ Shared_Layout.cshtml: 8 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 Система. Web.WebPages.WebPageBase.ExecutePageHierarchy (страница WebPageContextContext, писатель TextWriter, WebPageRend eringBase startPage) +90
спасибо. я, наконец, отказался от YUICompressor и начал использовать squishit: https://www.nuget.org/packages/SquishIt. Это гораздо более безболезненно! –