Getting jQuery Intellisense Functioning in Visual Studio 2008

It was announced today at the Microsoft Professional Developers Conference that Visual Studio 2008 supports Intellisense for jQuery with an additional file available from jQuery.  The file is available from Google Code

There are no instructions included with the download but I took the time to get jQuery Intellisense to work in one of my ASP.NET MVC projects.   In order to get this to work I did the following:

1. Downloaded the jquery-1.2.6-vsdoc.js to the Scripts folder of my project along side my jquery-1.2.6.js file.

2. In my project I referenced the jquery-1.2.6-vsdoc.js file in my Master Page so I could reference it anywhere, like so:

jQueryUse

3. Once this is in place a simple test of function was created and Intellisense was tested:

jQueryIntellisense1

The reference to jQuery can be clearly seen here.

jQueryIntellisense2

The list of methods available as part of the jQuery library can also be seen.

This was pretty easy, the key part is making sure you have the proper path set for Visual Studio to find the jQuery JavaScript files.   I used the path as “~/script/jquery-1.2.6-vsdoc.js” and placed it after the reference to the main jQuery JavaScript file, referenced the same way. 

I hope this helps someone else trying to get this going.

Visual Studio 2008 Tips I Should Know

VisualStudioThumb Stephen Walther had a great, practical post recently on his blog with a set of tips and tricks to help developers make better use of Visual Studio 2008.  I have to admit I didn’t know many of these tips and wonder what else I might be missing.  I will pay better attention to shortcuts as I run across them.

Here is a summary of the tips, but check out Stephen’s post to see them in action:

  1. You don’t need to select a line to copy or delete it, use CTRL-c
  2. You can add a namespace automatically by pressing CTRL-.
  3. Never create properties by hand
  4. You can remove and sort unnecessary using statements
  5. Use CTRL-k+c to comment out code
  6. You can close all documents except the current one
  7. You can open a database by double-clicking the database file in App_Data
  8. You can copy a file or folder into a project by dragging and dropping
  9. Use CTRL-SPACE to perform statement completion
  10. Add new items by pressing CTRL-N or CTRL-SHIFT+A
  11. You don’t need to type file extensions when adding a file

Reading the comments in this post is worth the time as well with some other useful tips:

  1. CTRL-x to delete the current line.
  2. CTRL-r+e to encapsulate a class variable into a property.

Another source of shortcuts is the Visual C# 2008 Poster from Microsoft, a PDF cheat sheet for magical key bindings.  I also use ReSharper (R#) which has many keyboard shortcuts and it maps to some of the key bindings used by Visual Studio to supplement the features, which is nice.

Fixing the Toolbox in Visual Studio 2005

I have had the extreme pleasure of working with Microsoft SQL Server 2005 Reporting Services lately (notice the extreme sarcasm in my tone).  I am working on a project for a large client and one part of the project requires I enhance a report to support multiple languages.   This post is not about localization but a rather strange issue I faced today.

I opened up my project in Visual Studio and proceed to open the report I needed to analyze for changes and decided to look at the controls at my disposal to help enhance the report and was greeted by this set of controls:

ReportingServicesToolBoxBefore

Interesting, all the controls are just Textbox.  Obviously this isn’t right and I had to do a bit of searching around the net for a few things to try.  The first suggestion I found was to right click the Toolbox and select Reset ToolBox….this had no effect.  Several suggestions didn’t seem right but I finally tried one which worked.  It involved a few steps:

  1. Shutdown Visual Studio
  2. Locate the directory – C:\Documents and Settings\<user name>\Local Settings\Application Data\Microsoft\VisualStudio\8.0
  3. Delete all files named Toolbox.* (there were 4 of them)
  4. Restart Visual Studio

The directory listing where the Toolbox files live looked like this:

VisualStudioToolBox

When Visual Studio restarts it will recreate the Toolbox files based on what is installed on the system.  After restarting Visual Studio my Toolbox looked like this when editing a report:

ReportingServicesToolBoxAfter

The steps are pretty trivial when you know what they are but finding the solution took a bit of spelunking but it worked like a charm.  I don’t know what actually caused this to happen but I don’t have the time to find out why.  If someone has the reason I would love to know why.

Visual Studio 2008 Now Running Side-by-side Visual Studio 2005

I have been having a few Vista problems lately and paved my system and put Windows XP Pro back on it.  I figured this was a good time to setup my development environment the way I wanted it.  My goal was to have Visual Studio 2005 and Visual Studio 2008 on the same system.

Visual Studio 2005 Environment

I know Visual Studio 2008 can target the .NET Framework 2.0, which I have some client applications running, but opening a Visual Studio 2005 project in VS 2008 converts the project to a new project format and you can no longer open the project in VS 2005.  The only way to do this is maintain two separate project files for each solution.

My current development environment consisted of:

  • Visual Studio 2005 with Service Pack 1
  • SQL Server 2005 Developer Edition with SQL Management Tools
  • SQL Server 2005 Express
  • .NET Framework 2.0
  • .NET Framework 3.0
  • GhostDoc 2.12 for VS 2005 
  • MSDN Library
  • Visual SVN 1.31 and Subversion

My environment is pretty simple, not many add-ins.  I don’t like too many add-ins as I travel to clients and if I have to work on different systems I don’t want to be handicapped by the dependency on a third party tool a developer may not have.

I installed the above tools and made sure everything worked as before with my projects.  Everything worked fine.

Visual Studio 2008 Environment

I wanted to get my VS 2008 environment as close to my VS 2005 as I could with a few extra tools.  The environment looks like this:

  • Visual Studio 2008
  • SQL Server 2005 Developer Edition with SQL Management Tools (already installed)
  • SQL Server 2005 Express (already installed) 
  • .NET Framework 3.5
  • GhostDoc 2.12 for VS 2008 
  • MSDN Library
  • Entity Framework Beta 2
  • Entity Framework Tools CTP

I was installing from a clean install but if I wasn’t and had the VS 2008 beta 2 on my system I would have had to uninstall everything first.  I wrote an article for InfoQ on the subject.

I did run into a couple problems with the Entity Framework beta 2 on VS 2008.  The installer fails and apparently targets a certain .NET Framework 3.5 build.  A very helpful blog post from Ralf Rottmann did the trick. 

NOTE: Ralf’s posts shows a way to hack the MSI file using Notepad++ but there is a better way using a tool from Microsoft called Orca, which gives a nice editor for the MSIs.

Installing the Entity Framework Tools also failed and could fixed with the same method, also pointed out by Ralf Rottmann in a separate blog post.

Keep in mind if you run GhostDoc you will need version 2.12 which has a fix for running VS 2005 and VS2008 side-by-side.

Overall the experience went very smooth with the exception of the Entity Framework install.  Everything is running fine and getting along well.

 

When Installing Visual Studio 2008, Uninstall Everything First and Backup

Scott Guthrie has a nice post about what to uninstall BEFORE installing the RTM version of Visual Studio 2008.    Possible components are:

    • Remove “MSDN Library for Visual Studio 2008 Beta”
    • Remove “Microsoft SQL Server Compact Edition 3.5″
    • Remove “Microsoft SQL Server Compact Edition 3.5 Design Tools”
    • Remove “Microsoft SQL Server Compact Edition 3.5 for Devices”
    • Remove “Microsoft Visual Studio Performance Collection Tools”
    • Remove “Windows Mobile 5.0 SDK R2 for Pocket PC”
    • Remove “Windows Mobile 5.0 SDK R2 for Smartphone”
    • Remove “Crystal Reports 2007″
    • Remove “Visual Studio Asset System”
    • Remove “Microsoft Visual Studio Web Authoring Component / Microsoft Web Designer Tools”
    • Remove “Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime”
    • Remove “Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime Language Pack” (non-English editions only)
    • Remove “Microsoft Visual Studio Tools for Office Runtime 3.0″
    • Remove “Microsoft Document Explorer”
    • Remove “Microsoft Document Explorer 2005 Language Pack” (non-English editions only)
    • Remove “Microsoft Device Emulator 3.0″
    • Remove “Microsoft .NET Compact Framework 3.5″
    • Remove “Microsoft .NET Compact Framework 2.0 SP1″
    • Remove “.NET Framework 2.0 SDK”
    • Remove “Microsoft Visual Studio Codename Orcas Remote Debugger”
    • Remove “Microsoft Visual Studio 64bit Prerequisites Beta” (64-bit platforms only)
    • Remove “Microsoft .NET Framework 3.5″

    It’s important to backup any changes to the settings you made to your development environment, such as fonts, colors, etc.    This is done through the Tools menu and select Import/Export Settings.

    It’s also a good idea to backup your entire system.  I don’t see this kind of advice enough but I back up using Acronis TrueImage and get a good copy of my system out to my external USB drive, just in case either uninstalling does not work or the new install fails or maybe I uninstalled too much.

    UPDATE: Rick Strahl has the RTM up and running, so check out his post for details.

    Technorati Tags: ,

    Now that Visual Studio 2008 is Out, Where is My MVC?

    Now that Visual Studio 2008 has been released we are one step closer to having the ASP.NET MVC Framework in our hands.   This is one of the biggest pieces of Microsoft technology, in my opinion, that will change ASP.NET development for the better.

    Since I don’t have the ASP.NET MVC Framework in my hands yet I can only make statements from the demos I have seen and from those lucky few that have had a chance to play with it.

    So what makes having a different framework to write ASP.NET applications with besides WebForms important? 

    • One of the most important reasons to use the new MVC framework is getting rid of ViewState and ViewState management.  ViewState is one of those things that tend to creep up on you and before you know it your web page is huge and you have to start cutting down ViewState usage.  This is something developers should not have to worry about and manage, it’s just a waste of time.
    • Secondly, no more PostBack and PostBack Events.  Here we go again, something developers should not have to waste their time managing.  Frankly, having to have intimate knowledge of when to perform certain actions in various events leads to code that is hard to manage and maintain.  Unless you have this particular knowledge you may be inadvertently writing bad code.  I think this model was created to try to make web application development as close to being WinForm development as possible and make the job of the developer easier.  The intention probably wasn’t to make it harder.

    What do we really gain from an MVC implementation?

    • Developers will be able to make use of the framework from static as well as dynamic languages, such as IronRuby and IronPython.   Much of the things that make Ruby on Rails so attractive can now be done in IronRuby using the MVC Framework.
    • Architecting a solution will be much easier and cleaner when we have very clear separation between the view, the controller and our models.   When developing a solution in ASP.NET using webforms we always have blurred lines between our different layers, no real distinction.
    • Testing will be so much easier with the innate ability for testing in an MVC pattern, we will not be pulling our hair out trying to perform the tests we know we should be doing.  Sure, we can and do test now but it is not the easiest of tasks.
    • We can also chose how we want to handle our views with third party support such as NVelocity, Brail or Microsoft’s flavor of view engine that will support ASP.NET.  We will have choice available to us.

    We can forget about MonoRail and what that has given us.  MonoRail will find its place once the ASP.NET MVC Framework comes out.  My guess will be that it will take advantage of what Microsoft does and extend it for the better.    Hammett has some thoughts on this too.

    I think Ruby on Rails has a lot of influence in the MVC Framework and for good reason, Rails is popular, Rails works and it really helps create maintainable and testable code.   I really enjoy working with Rails and because of this, I am looking forward to the MVC Framework. 

    I hope the MVC team takes advantage of Rob Conery’s SubSonic project to give us things like Scaffolding and dynamically creating classes from our models.  I know LINQ will do wonders to make it happen.  I would like to add generation of controllers and models to my wish list too.

    Maybe Santa will leave the MVC Framework in my stocking……..

    Technorati Tags: , ,

    Somasegar’s WebLog : Visual Studio 2008 and .NET Framework 3.5 shipped!

    Well, today is a big day for Microsoft developers, Visual Studio 2008 and the .NET Framework 3.5 has shipped.  This is great news and should lead to other releases I am personally waiting for, including the ASP.NET MVC Framework.

    Chris Bowen talks about the Visual Studio 2008 Training Kit on his blog and gives a link to getting it.  This kit looks to be some really nice training for LINQ and C# 3.0.  I am downloading now….

    I guess most of us need to download VS 2008 from MSDN downloads as that is the way to get it right now.

    Technorati Tags: ,

    Unexpected Behavior in Team Foundation Server and Visual Studio Merge Functionality

    So, for one of my clients we use Team Foundation Server for our source control, overall it’s pretty good.

    I am working on a project for a client and we have two versions of the application.  The new version is the one in active development but we still need to fix bugs and make some feature updates to the original version.  The new version was created by branching from the original.

    Our updates to the original source tree need to be moved over and I planned to use the TFS Merge Feature.  I got ready to start my updates to the new source tree and on my first merge attempt I received this error:

    TeamFoundationError 

    Error : The merge target {0} is not mapped

    I stared at the error for a bit wondering what the heck could be wrong with my source control configuration, as it’s the same as so many other developers on the project.

    My usual path to problem resolution is to do a web search and if that fails then ask around the team.   The result of talking with our team of consultants resulted in it working on some systems but not on others.  The interesting thing was the difference in configuration between the have’s and have-not’s, the ones that worked were accessing both branches from the same TFS Workspace, but those that did not work had their environment broken up into two workspaces.  This was my configuration.

    I started looking around at the TFS Object Model Documentation on Microsoft’s MSDN site and found the Workspace class and realized the Merge() method was on this class, which would mean, or imply, inter-Workspace merging is not supported.  Here is a snippet from the MSDN Library:

    TFS_Merge

    This clearly shows where the Merge() method belongs.  I changed my configuration and removed the second Workspace:

    TFS_Workspaces

    Workspace #1 looks like this:

    TFS_WS1

    Workspace #2 looks like this:

    TFS_WS2

    And the two combined into just one Workspace:

    TFS_WS3

    This changed worked beautifully.  I am a bit surprised you can do inter-Workspace merging or a least I could not find one.  I can now Merge easily amongst my branches.

    Chris Bowen’s Blog : Major Visual Studio 2008 Announcements Today

    Look at the news on Chris Bowen’s Blog : Major Visual Studio 2008 Announcements Today.

    It looks like Visual Studio 2008 will be released to manufacturing by the end of November 2007.   This will be great news and will assure my team we can continue with our .NET 3.5 work, knowing we can have a released development environment sooner rather than later.  I was expecting Q1.

    One thing that does make me wonder is why no updates released to beta testers since the July 2007 Beta 2?

    I won’t matter at the end of the month.

    Technorati Tags: ,

    Public Hotfix Patch Available for VS 2005 F5 Debugging Performance Issue with ASP.NET – ScottGu’s Blog

    Scott Guthrie posted about a hotfix available for VS 2005 to fix a performance issue when debugging ASP.NET applications by pressing F5 to start debugging.

    This has been one of my pet peeves using ASP.NET debugging, the startup time is horrible.  I originally thought it was some of the third-party controls I used and when I couldn’t fix it, just assumed I would have to live with it.  This has been over 3 years of use.

    I hadn’t realized this was a known bug by Microsoft and finding this information today is like found money.  Yes, I am very happy indeed.