asp.net-optimization

How to add bundles with dynamic content to asp.net web optimization

妖精的绣舞 提交于 2019-12-05 18:10:01
I'm using SignalR, which maps to asp.net application on virtual path "~/signalr". SignalR dynamically creates javascript proxy hubs on app start with virtual path "~/signalr/hubs". So the url "[http://myapp]/signalr/hubs" is where dynamic javascript content is. How can I add this virtual path to Asp.Net Web Optimization Bundling? Asp.Net Web Optimization Framework starting from 1.1 supports VirtuPathProvider's: ASP.NET bundling/minification: including dynamically generated Javascript Actually I don't understand how to use these VPP's. Could somebody explain in details or better give an example

“The located assembly's manifest definition does not match the assembly reference” on nuget package

送分小仙女□ 提交于 2019-12-05 09:32:43
So I was persistently getting this error on the System.Web.Optimization package Could not load file or assembly 'System.Web.Optimization' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) I finally found the solution after much trying. The key was in the Assembly load trace. LOG: Redirect found in application configuration file: 1.0.0.0 redirected to 1.1.0.0. Here are the steps I took to resolve the issue. It might be possible to skip some of these but this worked for me: Uninstall the nuget

Minified script only in MVC4 BundleConfig

一笑奈何 提交于 2019-12-05 02:16:06
I am adding the following ScriptBundle in BundleConfig: bundles.Add(new ScriptBundle("~/bundles/javascript").Include( "~/Scripts/jquery-1.*", "~/Scripts/load-image.min.js", "~/Scripts/bootstrap.*", "~/Scripts/bootstrap-image-gallery.*", "~/Scripts/my.global.js")); This is referenced at the end of my _Layout.cshtml as: @Scripts.Render("~/bundles/javascript") When debugging I notice that the output of this script rendering is: <script src="/Scripts/jquery-1.8.2.js"></script> <script src="/Scripts/bootstrap.js"></script> <script src="/Scripts/bootstrap-image-gallery.js"></script> <script src="

ResolveBundleUrl not resolving all files?

a 夏天 提交于 2019-12-05 02:14:29
I am new to MVC so thought I would start a new project and try out some of the new features in MVC4. I have two css files in my Content directory, normalise_mini and site.css . When I use the following code: <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" /> It only takes my site.css file not my normalisation file. I have the following in my app start: protected void Application_Start() { // Remove all other view engines except razor: ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine());

ASP.NET MVC 4 app with bundling and minification, why is minification enabled in debug mode?

牧云@^-^@ 提交于 2019-12-04 22:35:57
I've just migrated an ASP.NET MVC 3 project to MVC 4 / .NET 4.0, and installed NuGet package Microsoft.AspNet.Web.Optimization in order to support bundling and minification of CSS and JavaScript. I've pretty much got bundling/minification working, the problem is it's always enabled. Even though the app is in debug mode, as configured in Web.config, all JavaScript includes are minified. As you can see from the below XML snippet, debug mode is enabled in Web.config: <system.web> <compilation debug="true" targetFramework="4.0"> ... </compilation> ... </system.web> An excerpt of my bundle

Is there any way to have a file extension in a bundle name?

一笑奈何 提交于 2019-12-04 17:40:24
问题 I would like to have define a bundle like this: bundles.Add( new StyleBundle("~/style.css").Include( //... )); If the bundle name is just "~/style" this works, but with the file extension it always returns a 404. I suspect the server searches for CSS and JS files on the drive and ignores the bundling system, but I can't find anyone else who is trying to include file extensions in bundle names. Is this possible to do without something like a URL rewrite? 回答1: You could add the following to

Trigger the bundle inclusion from partial or editor templates in ASP.NET MVC 4

♀尐吖头ヾ 提交于 2019-12-04 16:04:50
I'm building a framework on top of ASP.NET MVC 4. I like the new bundling feature in MVC4 but I'm running into an issue and I'm not sure if the new bundling features address this scenario. My layout view is rendering it's script bundles at the bottom of the page before </body> . Since my project is a framework, the view doesn't know all of the bundles that the page will need. My project is making heavy use of editor templates, which may need to include some javascript, but can't render it in the editor template itself because: The script needs to be included only once and the editor template

System.Web.Optimization and Microsoft.Web.Optimization won't load reference in vs 2012

[亡魂溺海] 提交于 2019-12-04 08:51:27
问题 I'm working on an MVC 4 project started in Visual Studio 2010. Right now I'm working on a machine with Visual Studio 2012 as I don't have access to the machine I was originally working on. I tried all morning to find answers, but they don't seem to help my situation. I followed How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app and installed from nuget right into my solution. Even though I have all the required reference packages downloaded and installed on my

Runtime dynamic bundling and minifying in MVC 4

ぃ、小莉子 提交于 2019-12-04 08:20:38
问题 I was wondering if anybody can help me with bundling and minifying using the new optimization namespace shipped with MVC 4. I have a Multitenant-application in which I want to decide which js files should be loaded based on settings per user. One approach would be to create all bundles upfront and change the virtual path of resolvebundleurl based on the setting of the user, but that feels not really the right way. Also I have dynamic css in a cshtml view based on user-settings, which I would

What is the proper use of IItemTransform for correcting paths in CSS Bundling with ASP.NET Web Optimization and BundleTransformer?

梦想与她 提交于 2019-12-04 07:19:52
I'm presently working on a project that uses the ASP.NET Web Optimization library (v 1.1.0-Beta1) in conjunction with the Bundle Transformer extension (v 1.7.3-Beta1 for core, 1.7.0-Beta1 for LESS) which is used to convert LESS into CSS. Based on web searches paths within CSS (and less) appear to be a common issue, in most cases it is recommended to manually modify the CSS and be done with it. However, due to differences between our development and production environment, and not owning the affected CSS such a solution is not feasible. Two solutions seem to exist. The first is to overlay the