Skip to main content Skip to footer

jQuery is undefined in Visual Studio 2013 Preview

If you are trying to use ComponentOne's (or other) Custom Controls in Visual Studio 2013 Preview, you will see this JavaScript error: jQuery is undefined. jquery-undefined The culprit is a new feature called BrowserLink that is enabled by default in the Visual Studio 2013 Preview. The bad news is that is on by default. The good news is that it is easy to fix. If you add any ComponentOne Control to a page and run the application this error will occur. If you continue to inspect the HTTP requests, you can see the issue. All embedded resource requests are returning 200 OK status, but their response body is empty. empty-response Our Controls depend on jQuery, along with other JavaScript and CSS files. Therefore, they are completely broken when BrowserLink is enabled.

How to fix it

There are two ways to fix this issue. The first is to just disable BrowserLink in Visual Studio. In the toolbar, you can click the BrowserLink dropdown and uncheck "Enable Browser Link". disable-browser-link Another option is to fix it per project. This is my preferred method since it only needs done for projects using our controls, and it can also be applied to many machines by adding it to Source Control. To disable BrowserLink for a single project, simple add the following to your web.config file.


<appSettings>  
  <add key="vs:EnableBrowserLink" value="false" />  
</appSettings>  

After applying either fix, just run your application again and everything should be OK. Make sure to clear your browser cache too. Notice that all of the HTTP Requests to embedded resources are not returning the correct content. fixed Microsoft is aware of the issue and has reported it fixed. We are all looking forward to the next release so that our Controls are not broken out of the box in Visual Studio.

MESCIUS inc.

comments powered by Disqus