Метод YUICompressor.NET не найден Ошибка ICompressor.get_ContentType()

Я пытаюсь использовать YUICompressor.NET в своем проекте. Это веб-проект asp.net mvc, фреймворк 4.5.1.

Я получаю эту ошибку:

Method not found: 'System.String Yahoo.Yui.Compressor.ICompressor.get_ContentType()'.

at :

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 , ответ BundleResponse) +0 System.Web.Optimization.Bundle.ApplyTransforms(контекст BundleContext, String bundleContent, ссылки IEnumerable1 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(IEnumerable1) +296 System.Web.Optimization.AssetManager.DeterminePathsToRender(ресурсы IEnumerable`1) +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\Documents\Visual Studio 2013\Projects\WebApplication4\WebApplication4\Views\Shared_Layout.cshtml:8 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter Writer, WebPageRenderingBase startPage) +90


person Veysel Ozdemir    schedule 20.11.2015    source источник


Ответы (1)


Пакет YUICompressor.NET.Web.Optimization nuget в версии 2.7.0 имеет неправильную зависимость. Требуется YUICompressor.NET в версии 2.0.0 или выше. Но требуется версия 2.7.0.

Обновление YUICompressor.NET до версии 2.7.0 должно это исправить.

person user3182663    schedule 29.01.2016
comment
спасибо низкий. В конце концов я отказался от YUICompressor и начал использовать squishit: nuget.org/packages/SquishIt. Это намного безболезненнее! - person Veysel Ozdemir; 26.02.2016