Visual Studio - javascript file generation almost freeze PC - how to disable - javascript

right now I'm writing a code in Visual Studio 2017 (Community).
The code is a mix of Asp.Net, C# and Javascript (with some plugins, like jQuery, knockout, etc..)
I'm facing a very frustrating thing in visual studio that is EVERY time I modify and save a single javascript file, Visual Studio starts a generation of ALL javascript files that slows down A LOT the computer (SSD, intel i5, 8gb RAM) until it finishes, sometimes I need to wait it finish to be able to continue writing my code.
I don't know why VS do this, but I want to know if it's possible to disable it and prevent VS to generate/compile those files every time a save just one file.
Here goes an image that show what VS do:
Somebody knows what is that and what can be done to disable it?

I was having a similar issue, and disabling the language service seemed to help me.
Tools > Options > Text Editor > JavaScript/TypeScript > Language Service
Disable Language Service

Related

Debugging Visual Studio web application in Release Mode

I have a Visual Studio 2013 Web Application project that breaks when in Release mode. No console errors are thrown and I think that it must have something to do with script minifying/concatenating. Everything's fine when I build in Debug Mode.
So I'm trying to figure out how to debug when in Release mode and having no luck.
Most articles, like this one, suggest modifying C/C++, Linker and other properties... but I don't have see those options, I assume because I'm working on a web app project.
Are there other ways I can enable debugging, break points, console.logs, etc in Release Mode?
If you're trying to debug a web application then no you're not going to see those options, as they're only available for C++ solutions. To debug a C# or VB web application you need shouldn't need to do any special configuration.
If it's not working however there are some simple things you can check, firstly that the PDB files are generated. These are essentially debug symbols that match the original source code up to the compiled output, allowing visual studio to step through the code and they should be placed in the same directory as your DLLs.
Once you've got your PDB in place all you need to do is attach the debugger. Now for a web application this can be a little confusing at first (if you're using IIS). IIS has several application pools:
The IIS process that you want to attatch to is called w3wp which is a little confusing at first. And potentially there are several of them (one for each AppPool that is active and running). Make sure you've got the Show processes from all users checked to see the processes listed:
To make this whole process easier, if you're running a version of Visual Studio that allows extensions take a look at AttatchTo. It adds a menu option you can click (and convert to a toolbar button/shortcut) that will automatically attach to all the IIS instances to debug your code.

Visual Studio 2013 can't debug javascript in cshtml

I have an ASP.NET Web Application created with Visual Studio 2013. I am attempting to debug JavaScript in a CSHTML file. However, whenever I launch the webpage, any breakpoint turns into a red circle arrow and states, "The breakpoint will not currently be hit. No executable code of the debugger's target code type is associated with this line. Possible causes include: conditional compiliation, compilier optimizations, or the target architecture of this line is not supported by the current debugger code type."
Recently, the project was switched over to support MVC and RAZR, neither of which I know well, and this is exactly when this issue began. However, searching those have yielded results that don't fix my issue.
Web.config:
<compilation debug="true"...>
I know I can debug JavaScript with Firebug or some other browser tool, but I would much rather stick with Visual Studio's debug as that is what I am used to.
So, apparently this is a "known issue" that will be fixed as soon as possible. A temporary work around that works for "some" people is making sure any Javascript is in a separate file.
It is caused by having RAZR and Javascript in the same file and Visual Studio 2013 not being able to handle debugging in that instance.
I don't know what your particular problem is, but if you want to force a debug breakpoint to always happen, add debugger; to the line that you want it to stop on, and it will stop. This is regardless of where the JS is located (in a .js file, .html, cshtml, etc.)
Here is a blog post about it:
http://sumitmaitra.wordpress.com/2013/12/11/quickbytes-visual-studio-2013-and-javascript-debugging/
I also agree that JS should go in a .js file (which I've never had a problem adding a break point in a .js file), but for quick prototyping, this is a solution you can use.
If that still doesn't work, you can always you the F12 tools
The only browser that allows debugging a javascript file from Visual Studio is Internet Explorer. (this is what I found out after testing my application on different browsers)
I put my javascript in a separate file and debug with IE otherwise it will not work.
For some reason chrome doesnt allow you to step into the javascript.
One additional thing to check. If you have a App_Start|BundleConfig.cs (which came with MVC 4 - or maybe 3), set BundleTable.EnableOptimizations to false (or, like I did, wrap it in an #if !DEBUG #endif and take the default setting).
I tried and failed to use Chrome and then IE and ended up using the Firebug addon in Firefox, and I was able to debug and set breakpoints in my JS with no problems (in an MVC6 app on Visual Studio 2015 where this is apparently still an issue?!)...
FYI - When I tried to debug my JS in Chrome using the F12 Developer Tools, it told me it was not an option as the Debugger was already attached to another process...
For people coming here in 2017, I want to share that I had this same issue with VS2017 Enterprise RC, and with VS 2015 Community with any browser but Internet Explorer. Using IE did the trick for me.
Also, in VS2017, I had to add a debugger statement to get VS start looking at debug points.
Finally, I'd like to ask at least a comment from people voting down.

Html+css+javascript development with Visual Studio

My main experience with developing in Visual Studio is as c#/c++ developer. But now I need to create html+css+javascript front end for [probably] PHP code, and I've heard that Visual Studio has pretty nice capabilities in that range, including debugging javascript.
However, I can't find anywhere a "web" project (except for the ASP.Net stuff, which I'm not sure that it is the right thing).
Here's what I think I need to do:
Create html file
Create css file
Include a bunch of javascript libraries
Write my own javascript code
Press F5 and debug the code in different browsers.
I'm mainly interested in intellisense, not a visual editor.
Is Visual Studio the right IDE for this kind of web development? And if it is, how do I set up the kind of project I described above?
I think the instructions at How do you add a folder to a project in Microsoft Visual Studio Express 2012 for Web? might work for setting up a Visual Studio project:
1) New blank solution
2) Right click on the solution and select Add existing website
3) Browse and select the folder with your html, css, javascript, etc. files
4) Right click on the page you want it to start on and select set as start page
As for running against different websites, you might try a Visual Studio extension. A decent starting list is here: http://www.asp.net/mobile/device-simulators

Javascript, Firebug: How do I have multiple views or what is the right of way of doing development?

Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing javascript applications using firebug?
Something like a mini IDE would be awesome: It just has to let me insert some code, examine the current page and then let me execute it. Any suggestions?
I use a simple text editor (vim) to write Javascript and HTML, and I check the result every now and then in Firefox. I have always two windows open: one for my text editor, and one with the current page open in Firefox. After saving a change in the Javascript, I switch to the browser and refresh the page to observe results. That was my workflow until recently.
A couple of weeks ago, I discovered the Combiner tool by Nicholas C. Zakas. To release my Javascript code, I am now using a complete build process based on Apache Ant, similar to what I was using while doing Java development previously.
The first step is to check the Javascript code with the JSLint tool by Douglas Crockford. I used to painfully copy and paste my Javascript code in the online version of the tool, once in a while; being able to run it on all my Javascript files at once with this Ant script is a huge convenience.
The second step is to combine all my Javascript files into a single file using the Combiner tool. The third step is to minify the Javascript code using YUI Compressor by Yahoo!. These last two steps allow to optimize the delivery of Javascript code to reduce page loading.
You can find an example Ant build file that you may adapt to your own needs. I am currently using this file to build my own Javascript library, bezen.org.
The other answers so far have been correct: I've never heard of anyone actually developing inside Firefox/Firebug, because it's a tool designed for debugging, not coding. To do your coding, you should use a tool designed for it (either a text editor or a full-fledged IDE).
But that being said, you might want to check out FireEclipse (Link). It will allow you to integrate Firebug with the Eclipse IDE (which itself has at least three different JS plug-ins to choose from). Alternatively I think the main (aka Web Standard Toolkit, aka WST) JS editor for Eclipse has some functionality which is similar to Firebug, but I've never used it so I don't know the details.
Hope that helps.
Write your HTML in an editor/IDE
Save your changes
Preview it in your browser
Debug using Firebug
Make your code edits in your SOURCE CODE
Repeat
Firebug is for debugging and allows you to do some "what if" fiddling while the page is live. This is not a replacement for an IDE.

Loading IIS website in Eclipse

I am not sure if there's a way to load an IIS website into Eclipse. Similar to the way we can load in Visual Studio through File > Open Website
Thanks
Short answer: no.
Slightly longer answer: with an open source web application server such as Tomcat you can run it inside Eclipse. You can set breakpoints, check variable values at runtime, etc. However, Microsoft is about as far from open source as you can get; if you want to run IIS through a debugger, you're going to have to use Visual Studio or some similar MS-only tool, because that's how MS designs things.
Of course, as Kekoa pointed out, you can always load the individual files in Eclipse, but then you're just using it as a glorified text editor; to get the full power of all of it's "IDE" capabilities, you really need to use a non-MS (and non-proprietary in general) stack.

Categories