我试图用YuiCompressor nuget包来混淆我的js文件。
安装软件包后(" Yui Compressor .NET " +" Yui Compressor .NET - Web.Optimization &#34 ;),我使用以下代码更新了我的BundleConfig文件:
JavaScriptCompressorConfig jsConfig = new JavaScriptCompressorConfig();
YuiCompressorTransform jsTransfrom = new YuiCompressorTransform(jsConfig);
var script = new Bundle("~/bundles/name", jsTransfrom);
script.Include("~/content/file.js");
bundles.Add(script);
运行代码时,我收到此错误:
System.TypeLoadException: Inheritance security rules violated while overriding member: 'Yahoo.Yui.Compressor.Web.Optimization.YuiCompressorTransform.Process(System.Web.Optimization.BundleContext, System.Web.Optimization.BundleResponse)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
at MySln.UI.Website.BundleConfig.RegisterBundles(BundleCollection bundles)
at MySln.UI.Website.MvcApplication.Application_Start() in c:\TFS\MySln\UserInterface\Website\Global.asax.cs:line 23
我正在运行VS 2013 + .net framework 4.5。
我怎么能解决这个问题?
谢谢!