I have an ASP.Net project framework 4.5.2. When I set the compilation debug="true" in web.config, the page is working fine. When I set the debug="false", the page cannot be rendered. It shows special character as below:
Please give me the solution to fix the issue.
My best guess?
When you set debug= false?
That forces the project to use the min (minimized) version of your JavaScript libraries.
For example I modified some of the JavaScript routines in the ajaxtoolkit library. Debug=false never worked or saw my JavaScript changes.
So I installed a JS minimizer package. Now when I modify the JavaScript. I at that point in time also run the minimizer against that js routine and thus when you use debug=false, then your project will now be using the js.min versions of your JavaScript libraries.
Minimization is a huge topic - way way beyond a simple post and answer on SO.
However flipping debug= false does mean your now using the min version of those JavaScript libraries - and thus they must exist - so I would look and check what JavaScript libraries that page uses. You can compile the application as release, but setting debug=false also means JavaScript.min libraries will be used.
So check above in regards to what JavaScript libraries that page uses (and ensure the min versions of those libraries exist before you attempt a publish)
Edit --
Also,try clearing the browser cache - all of it.
For my case, the problem was caused by WebMarkupMin package. The page implements WebMarkupMin's MinifiedAndCompressedHtmlPage class.
Related
i am loading the bootstrap and jquery packages from nuget:
but i get an error message in chrome console saying that
$ sign is not defined
do i need to referense the jquery lib file, from the aspx page?
if do so, what happen when jquery gets updated, his file name will update too?
In short, yes. You will need to reference the jquery file in every page you use it in. Alternatively, if you are using a _Layout page, you only need to do so once. In terms of the updating issue, your jquery file should not update automatically so you should be fine.
You could also make sure you have jquery migrate installed so that you never have deprecated or code breaking errors in your program. jQuery Migrate
Also consider using jQuery CDN rather than having the files stored locally as this can make updating and upgrading far easier
I'm using ASP.NET 4.5 MVC4 and I've setup a bundling of css and javascript files with custom made bundles that worked before.
I've made the bundles myself, because the load order is important.
Somehow it stopped working. I did an update to the latest WebGrease (1.3.0) recently. Could that be a problem?
The strange thing is it works when I set BundleTable.EnableOptimizations to false. But when I set it to true, I get js errors.
Which js errors do you get? The main difference with the property EnableOptimization to on (see this page) is that it concatenates all your scripts and minifies them.
I'm trying to setup VS 2012's new bundling functionality (via the Microsoft.Web.Optimization package - read more here) and for the most part, everything is working alright. The problem is that the processing just gives up after ~15000 characters.
When I build and run the page, I get a bunch of failures because the JavaScript files that have been loaded are truncated halfway through a line in the middle of a function...
Has anyone else experienced this or does anyone have any insight into how resolve this issue?
--UPDATE--
I originally encountered this error using foo.AddDirectory("~/scripts/", "*.js"). Using foo.AddFile("~/scripts/bar.js") only results in the javascript errors when I include any jquery plugins. No errors are being thrown on the server.
--UPDATE2--
The problem was a result of the Web Optimization library not being up to date. I highly suggest that anyone attempting to use this retrieve the library via NuGet command line: Install-Package -IncludePrerelease Microsoft.AspNet.Web.Optimization. There are various versions of documentation and examples on the web, but the most current can be found using the above method and the most current documentation is that found in the answer below.
Do you have a small repro? My guess is that maybe there's an issue with the javascript files that are in the bundle.
Its also possible the minifier is choking on something and/or incorrectly minifying them.
If you are using the Scripts.Render helper, have you tried running with debug = true to make sure that everything works correctly with no bundling or minification?
Here's also the latest documentation which might be helpful: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
Our application registers events OnInit. When developers create a new aspx file from the visual studio template, it has AutoEventWireup="true". This leads to event handlers being registered twice and run twice.
Is there an easy way to cause the compile, build or other post build step to fail when the directives are set "wrong".
I'm using Visual Studio 2010 and TeamCity. I'm open to running any technology as a postbuild step.
You could precompile your site. Precompiling involves compiling the aspx and ascx files aswell as the .cs. It will make your site faster and it ensures things hook up a bit better, the downside is you cant change the aspx or ascx after you have compiled them.
http://www.dotnetperls.com/precompiled
This SO page describes a couple of ways of doing it
Compile Views in ASP.NET MVC
You could try integrating StyleCop with TeamCity, and create a custom StyleCop rule that checks for this. Not sure how difficult it would be, but it's what comes to mind. See this question about using StyleCop with TeamCity.
Also, as suggested by Erix, update your templates to prevent this from being the default behavior.
I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin from a URL, then execute some code from within the plugin (e.g. add a control to the page).
You can use either Modules or RSL.
RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer.
Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet.
Here is some documentation on creating RSLs http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:Flex_3_RSLs
Note that, currently, loaded RSLs must be compiled against the very same version of the Flex framework.. if you plan for a "binary" plugin system, probably you want to wait for the Marshall plan feature to be implemented, in the next Flex version.
If you want to try a new and alternative approach, this is a application core framework modelled after java OSGi: http://www.potomacframework.org/
I haven't tried it myself, but it looks really cool!