Posted
by
timothy
on Thursday August 04, 2005 @04:15PM
from the invisible-studio-is-less-visual dept.

Jim Holmes writes "Microsoft's Visual Studio is an elephant of an IDE. It's got tremendous power and adaptability, but it's difficult to dig through all the less-than-helpful documentation. It's also very tough to figure out which of the many available add-on tools are worthwhile to add. Visual Studio Hacks by James Avery is a terrific reference for helping get the most out of Visual Studio." Read on for the rest of Holmes' review.

Visual Studio Hacks

author

James Avery

pages

512

publisher

O'Reilly

rating

Outstanding

reviewer

Jim Holmes

ISBN

0596008473

summary

Get the most out of Microsoft's Visual Studio

Disclaimer: James is a friend who's helped me with starting a developers group, and I'm also working on an open source project with him. The possibility exists that I may work on a paying project with him at some time in the future; however, I haven't had any financial dealings with him so far. (Other than I still owe him a beer for coming to speak at one of our group's meetings.) For what it's worth, I spent my own money to buy this book from Amazon. End Disclaimer.

Avery's book is great both for new users of Visual Studio as well as the more experienced developer. Also, readers won't have to worry about buying a book which will be outdated when Microsoft releases its next version of Visual Studio in November. Tips and tricks are included for Visual Studio versions 2002, 2003, and 2005.

VS Hacks spreads 100 "hacks" across 13 sensibly delineated chapters. Each hack is clearly marked with its number in a blue box at the upper, outer corner of each page. Hacks are also marked with a thermometer icon representing the hack's relative complexity. One of my few complaints about the book is that the moderate and expert icons look too similar - but frankly I ignore these icons anyway, so the criticism's most likely wasted.

The introductory chapters on projects and solutions, navigation, and editor usage aren't introductory in skill level. Avery covers these topics in great depth, diving down to some useful, but less-than-obvious settings in VS's environment. Examples of this would include Hack #2: Master Assembly and Project References, where Avery shows how to add additional assemblies to the Add Reference dialog's list of .NET assemblies. This is a timesaver if you've got custom libraries you make frequent use of; adding the assemblies to the default list saves having to use the Browse button to search for the files every time you need to add them.

Some of the most uninteresting drudgework in development involves writing code for basic software elements such as business entities or data access layers. It's repetitive, it's template-like material, and it's boring. Documenting such work is every bit as tedious.

Hack #50 covers using CodeSmith to generate code via templates. Other hacks detail tying UML into the development process. Hack #81 covers using Visio for Enterprise Architects to generate code from UML diagrams. Hack #82 covers the opposite of that process: generating class diagrams via Visio's reverse engineering support. (UML's capable of much, much more than the simple drudgework of business entities or data access layers, and these hacks shouldn't be confused with anything more than a cursory introduction of how to tie UML via Visio into Visual Studio.)

One of the most useful sections is Chapter 5: "Debugging." This chapter focuses on getting the most out of Visual Studio's debugger capabilities. These hacks are critical helpers to good developers effectively use Visual Studio's debugger.

Avery covers the basics of setting up breakpoints, diving down to various options such as setting how often to break on specific break points, or setting conditional break points. He then moves on to troubleshooting breakpoints in Hack #37, and there's also great coverage on using Visual Studio to debug scripting code inside a browser session, working with SQL server, and attaching to a running process or one that's just about to crash.

I found the best content of this book in hacks focusing on making the most of tools both inside and out of Visual Studio. Hack #79 is a great section detailing how to stress test web applications using Visual Studio Enterprise Architect's Application Center Test. This hack makes it easy for readers to understand how to get detailed stress testing on a web application. Along this same line, Hack #80 shows how to make use of the Dotfuscator tool to obfuscate .NET assemblies to protect them from modest efforts at reverse engineering. (Like Java, .NET assemblies can be disassembled, revealing all your hard work and intellectual property.)

Other gems in this same arena include tools for running and debugging unit tests inside Visual Studio (#93), testing regular expressions (#100), and using tools which automatically generate documentation based on naming conventions in the source code (#69).

The mechanics of this book are great. The Table of Contents breaks down each chapter by its individual hacks, and the index is very detailed and clear. I also like how hacks are listed on the top of each page, making it quick to find something if you know the hack's number or name and don't want to fuss with the table of contents.

My sole complaint about the book (aside from the annoying thermometer icons I've already mentioned) is that it's not always clear which add on tools work with which version of Visual Studio.

This book is a critical addition to the bookshelf for any developer who spends any amount of time working in Visual Studio. You'll become much more productive by using tips in the book, and you'll find tips to help you decide which add-on tools you'll want to make use of. More importantly, you'll understand how to get the most out of Visual Studio's capabilities.

Too bad it doesn't mention 6.0. That's what I still use for everything. Completely compatible (that's what MS is good for), and it does everything I need it to do. No need to drop the $$ for anything newer...

Is it just me or is a "hacking" culture growing out of the internet? People are getting fed up with the limitations put on them by business' slowness, so they push the limits of current technology to meet their needs.

Is this because people's needs are growing faster than industry's ability to provide them?

I don't think a GUI platform can call itself complete until it's got an IDE that's worthy for programming.

The only one I've seen so far for Linux that's up to par (and just barely) is KDevelop, which is entirely useless to you if you don't use Qt, like myself.
And yes, I know about a lot of the alternatives, they just all suck so bad they aren't worthy of mentioning by name. Eclipse is better than most, but is java, and slow....

Same here. The last thing I need is the app flashing information in front of my eyes every time it thinks I need it. Even if I were to turn it on, it would only be useful about 1 out of 50 times that it would pop up, who needs all that visual noise while trying to code. I can type thank you very much, and unlike Microsoft, I give my classes and methods consistent and logical names so I don't have to look everything up all the time.

If you ever work on a big application where you can't memorize the thousands of function and method signatures, or you have to quickly use code you've never seen before, intellisense will become more valuable to you.

its better to look up its definition in the source so I can see the comments on the inputs.

Perhaps you should actually try intellisense before you talk out your ass. Intellisense does show you the comments associated with the method you're calling, as well as the return type, and the comments associated with each of the individual parameters. As you move through the parameters, intellisense updates the tooltop to show you the comments associated with each input parameter separately.
People can blast

> if I can't remember the signature, its better to look up> its definition in the source so I can see the comments on the inputs.

Intellisense in VS *DOES* shows you the comments from the source. Why do you think that the source comments have to be entered in XML?? Why do think there's a whole thread of people saying how good it is even though it's an MS product? If you're not seeing the comments, then you haven't been following the templates or RTFM.

I hate to say it but it's fucking amazing - especially in VS.NET 2005.

The thread title is correct - it's Microsoft's Killer App.

> Besides, if you divide up the work correctly, you won't be using more> than a few percent of the functions in a program,

Not all companies are big enough to "divide up the work". I have to do the entire project on my own. Which after 6 months is a LOT of functions. I guarantee it would take nearly everyone except genius autistic programmers more time to write large projects if if VS.NET didn't have any intellisense.

I can't see how it can be annoying. If you type quickly without pausing then it doesn't even appear. If you really do know what you're supposed to be typing then you probably won't pause because. The only reason I can think of to pause halfway though typing a function call is if you're having to go and find the function definition because you can't remember what the next argument is:)

In visual studio you can attach to a running process on another machine and debug it exactly as if it were running locally. You can step from sql to C++ to.Net (lots of languages) to DirectX shaders... You can modify the code of said running process, recompile it, and patch it back into memory without restarting it. You can even do these things if the other machine happens to be an xbox. It's a massive set of tools, and the debugger is just one insanely awesome part of it.

Is "intellisense" the thing that gives you a dropdown of method names and similar? If so, there are multiple existing ways to do similar things in both (x)emacs and vim (although I'm not familiar with the procedure for doing it in the latter, so a vim master will have to chime in). There's dynamic abbrevs which work with almost everything and, while not context sensitive, are generally good enough unless you don't know and haven't typed the method. But it works in any mode, so if you're typing a letter

There are similar ways to do it for XEmacs and other editors, all less practical and efficient than the VS implementation.Not being context sensitive is simply unacceptable for example. When you start using namespaces, many classes,... it's simply essential.Regarding This is the power of a programmable editor. If there's a feature you want, you can add it. If there's a feature you want to change, you can modify it. If there's a misfeature, you can get rid of it.

I agree... I still do alot of coding in emacs, it's still my favorite text editor, I still open it up to do certain things to my code... but my projects finally go just too big, now I use visual studio where appropriate and Zend's IDE for my web projects and the savings in my time have more than paid for each of them.

On the other hand, bad (as most of the free IDE's out there are in my experience) are exactly the opposite... they waste time, they lose code when they crash, they generally are a hassle... bu

To say that VS.NET is the "ultimate killer app" sounds so outrageous that I'm tempted to think that a little astro-turfing might be going on here. VS.NET has a lot of features but it also has a lot of bugs. It's very slow when working with a large VB.NET solution. It also has periodic interop issues with VSS.

When VS.NET is acting up like that, I am grateful that I can just open up a text editor and edit the source directly like that.

Yeah well none of that can equal up to what a good IDE does. Just because you like to program in the shell, doesn't help those of us who like to program in the GUI.

Autotools are a crime when it comes to building projects.. I can't tell you how many hours I've spent tweaking those scripts until I heard about Scons, and it's not even an ideal solution; A good IDE allows you to click one button and have your software project built. Wanna customize the build? Don't worry about memorizing those archaic tags,

For me, a good intellisenseish feature in IDE A will cause me to use it over IDE B (without such a feature) in a heartbeat *no matter what* other feature IDE B has. I don't care if it runs like a dream, has the best debugger in the world, or whatever. If A has intellisense and B doesn't, about the only feature B could add that would make me switch is a telepathic "I'll write your code for you" feature.

I use vim, and it has ctags support and reverse tab completion and a bunch of other nifty things.Perhaps it's the projects I've been placed on at work, but I always find myself fighting Intellisense when I'm doing windows coding. It'll pop up with the wrong things when I don't want to be bothered with it, and it'll NOT pop up when I don't know how to use something and just want to see an interface list.

Other times I just use gvim, for my solaris, mac, vms, linux and several web development projects. I fin

It's not so much that I like VS's implementation of Intellisense. (It was reasonably poor in VS6, often not showing up. I've had little problem with VS.NET though.) I just used that term because it exactly describes what I'm talking about. (Something like 'code completion' doesn't, because I've seen other things that could be called that.)

I've done a lot of Java work recently in Eclipse for instance, and think that the Intellisense in Eclipse is fantastic.

I have to disagree there. My experience is mainly in Java development, but I have done some VC++ and VC#. In my experience, VS.NET 2003 simply doesn't compare to the likes of JBuilder and Eclipse in terms of features (and neither of them are perfect by any means). I'm not saying that it's a *bad* IDE, but every time I use it the lack of refactoring and code inspection tools drives me batshit insane in pretty short order.

Visual Studio appears to actually be the killer app to my system.I have a fairly decent system, but VS drives to incredible slowness.When I exit I have to re-boot to get the speed back.Does any one else have this issue?Seriously I'd like to know.

>Until Linux gets an IDE at least 75% as good as>MSDev, top-notch large scale applications for>Linux will remain few and far between.I don't understand why you were modded as insightful. I'm not trying to be sarcastic, but how precisely is MS Visual Studio a "killer app"? What makes it so impressive in your opinion that no Linux development environment compares with it, oreven as you say, "75%" as good?

For example, my development environment of choice is xemacs which I consider hands down the ultim

Now don't get me wrong, I love Emacs myself and use it everywhere, but every modern IDE I know of lets me define my own keystrokes and has hooks for absolutely every function, so the mouse arguement just doesn't hold water.Your other points I agree with wholeheartedly. (I'm currently getting into eclipse though, as I'm digging the refactoring stuff, and I rarely find myself developing in non-windowed environments or using the god-like emacs features that no one else has or probably ever will.

Until Linux gets an IDE at least 75% as good as MSDev,You haven't tried kdevelop or anjuta then, I assume? Not being familiar with VS (too poor, lol) I am not sure how they stack up feature wise, but I bet that both meet your "75%" criteria.

top-notch large scale applications for Linux will remain few and far between.You mean like Open Office, Mozilla or Blender3d? We have the apps; it's the mindshare we're lacking (if we're lacking anything, which I doubt now that we have corporate sponsorship from novell a

KDevelop doesn't have an intellisense type feature near as I can tell, and that drops it below the 75% itself IMHO.

I just tried it, and it doesn't even seem to do auto code indenting. If i type if(a==b) { , any half decent IDE should indent the following line. KDevelop didn't. (I didn't look for an option to turn this on, I'll be fair.)

That's interesting, I approach things exactly in the opposite direction. I am developing for Windows but use Linux as my primary operating system. I use KDevelop and prefer it over Visual Studio (disclaimer: haven't tried VS2005). I just find too many things are missing from VS for my liking. Good svn integration, doxygen, good command-line tools like find and grep, sloccount, etc. etc. etc. Additionally, compiles are SLOW using Visual C++. Much much slower than in Linux when I use ccache and also dis

What are you talking about? Linux has EMACS. Check your email, browse the web, read the newsgroups, write your documentation, be interviewed by the doctor, etc, all from within the same IDE! Who needs these new fangled gimics like VS.Net?

VS has some very esoteric features, but I love the
integrated browse info. It's better than ctags/etags because
it uses the compiler to generate the info.
Has anyone here thought about doing
something similar with g++/gdb?
There are a couple of ways it could be done.

Can we also have GDB make small source-level modifications to a running binary, like Visual Studio debugger did last time I used it.
(Disclaimer: it's a few years ago, they might have removed it since.)

Assume I've been living under a rock for a while: what is this "integrated browse info" of which you speak? How is integrated? What info are you browsing? Why is using the compiler to generate it a good idea? How would this differ from having a small script to post-process the output of 'nm' run over the generated object files?

If you use Emacs or vi or etc. you can navigate the source code by creating "tag" files which are cross-references between variable names and the source code lines where they are defined. VS has a similar, but more powerful, feature called Browse Info. Systems that use hueristics instead of using a compiler to generate the tags (or Browse Info) are not as accurate. nm does not give source (line) info, but your idea of post-processing (perhaps with gdb or addr2line or something) is similar to what I was hin

By browse information I mean the ability to navigate the source code. I don't know about KDevelop. Does it use the compiler to generate tags or does it use something (like ctags) that uses hueristics and doesn't completely parse the code? There are lots of IDEs with integrated source navigation, but do any besides VS actually uses the compiler to parse the code and generate the tags?

Is the the help system. I don't program Windows CE, but it's infested with stupid bloody WinCE specific help. Search for a Win32 function such as CreateWindow and often you're lead to the WinCE implementation. And the same for ATL & MFC classes. Worse is if you chose not to install the WinCE help at all since it still includes the index to the WinCE help. So double clicking on a help item prompts you to insert a CD. Filtering helps a bit but not a great deal since often you want to search anywhere, especially if your app spans Win32 and.NET for instance.

Even with this annoyance it's still better than help in XCode on the Mac. XCode 2.x is a big improvement but it's still hopeless compared to MSDE.

A second annoyance to DevStudio is the sheer mess of dockable windows. VC98 had it just about under control but since DevStudio 2002 it has become a disaster zone of tabs, splitters, pushpins, floaters and toolbars. Just trying to get all the relevant information onto the screen is hard enough. The pushpin model just works badly - either you pin a window to a frame or it annoys you by floating in and out at just the wrong point in time such as when you're mousing around.

A final irritation is that DevStudio is extremely primitive compared to a lot of Java suites. Eclipse is hopeless for visual design but it kicks DevStudio around the shop for sheer coding. Being able to hit Shift+Ctrl+R and rename all references to a class or variable everywhere in Eclipse is mindbogglingly useful. While I expect the next incarnation of DevStudio will allow you to rename a class, it's notable by its absence in the current releases. It's not like Eclipse just introduced this feature since JBuilder has had it for years.

I agree entirely with this sentiment about WinCE. You can use filters in MSDN to get rid of it, but its damn near impossible to do it properly. They tried to fix it with the lateset release of MSDN library (on disc Im talking about) by having a 'Desktop and Server OS' filter, but unfortuantly it also filters all the Web stuff and scripting etc which is annoying. Every search requires twice as much effort thanks to WinCE documentation.

A also agree that it is annoying, but in most cases the documentation is near identical for the CE version. I just use the CE docs unless I have reason to think they are different for some particular function.

Have to agree the Help system has a really really bad habit of bringing up useless WinCE help instead of what one is coding for - wish it would figure out from the Project that you DON'T want to code for WinCE and not bother you with extraneous carp like that.And I also find the dockable windows do make it easy to get lost - or figure out which one disappeared.

Renaming references quickly is, admittedly, not very good, especially if you have code snippets that use them - it would be nice if it could at the v

Part of the problem for VE is that Java doesn't have a simple XY layout model

Actually it does. Set the layout manager to null and you can put components at any location you want and set the size to anything you want. Of course, if you've got the ability to change font sizes (e.g. to support people with visual difficulties, which is a legal requirement in some places) then absolute layouts suck horribly...

I just talked with the program manager who owns our help system and he promised me that we've fixed the first issue you describe in VS 2005. You can filter out specific blocks of content now, which will enable you to get rid of the WinCE-specific help.

Also, you can now get content via the Internet or through the Local Help system, which means that you shouldn't ever run into "please insert a cd" messages again.

As far as our Tool Window situation goes, we have a way to go on improving this. I think we're doing better in terms of window management in Whidbey (VS 2005) than we did in previous releases. One cool new feature, the IDE Navigator (Ctrl+Tab) lets you navigate between every open document and tool window in the IDE in a fairly reasonable manner.

Also, we've added in either 5 or 6 refactorings to VS: you can perform operations like Extract Method or Rename Symbol now through that interface.

Finally, if you have feature requests or bug reports please post them on our Product Feedback Center. I happened to run across this post, but there's no guarantee that a Slashdot post will ever be seen by the team that owns a specific part of VS. The MSDN Product Feedback Center [microsoft.com] will let you submit issues or suggestions to us directly and will guarantee they're routed to the right people.

Cheers -- Aaron

Oh yeah, and I feel like I owe a VS "hack" now. When you're in the editor you can enable incremental search by pressing Ctrl+i and then typing a string to search for. The next instance can be jumped to by pressing Ctrl+i again.

Ever tried using TweakUI with its X-Mouse enabled? VID was the first app that misbehaved with it. That's okay, I didn't have to use it. VS.Net picked up the bad habits and forced me to go back to Windows' normal mouse behaviour. Why? Everytime the mouse goes over the app window it pops to the front, making things extremely frustrating.

Javac is written in java, so compiling anything requires firing up a jvm first, which can take a while.However, since Eclipse is written in java, the jvm is already running, so it can just call up the appropriate javac classes and run the compiler in-process, removing the latency of starting up a new jvm. That's most likely why Eclipse is much more snappy at compiles (off the top of my head; I haven't written any Java in a while).

Alternatively they could be using IBM's jikes compiler, which is written in C

A book on Visual Studio hacks has a lot going for it, but the examples in the review mostly sound like discussion of add-in tools, rather than VS itself.

Many people don't take advantage of even simple things like customising autoexp.dat for debugging, and don't know about undocumented UI tweaks like displaying a marker line at column N. Many of these little touches are what makes VS better than the alternatives for a lot of jobs, and why Microsoft never makes more of them I don't understand. Are things like the two examples above covered in the book?

I remember when I programmed in Visual Studio there was a good add on called Visual Assist, the company is Whole Tomato [wholetomato.com] I used like 3 years ago and it was quite nice, it adds some features to the IDE that make coding easier.

So I normally prefer to use emacs as my IDE, especially for anything complex, but for those times when I need to use Visual Studio I've been getting a little bored with the standard tools so hacked together an add-in (not just the tools or macros, but the proper add-in mechanism) framework entirely in perl... suddenly I can knock up simple reg-exp based editor tools and I don't need to descend to some crappy VB/C# level coding to do so...

But has anyone noticed what a complete mess the Visual Studio add-in API is ? A hybrid mixture of DLL export functions and nearly-COM like objects... very 1993... I think it must count as the biggest hack in Visual Studio.

I've used Studio 2003 new for the last year and a half. Overall I like it alot and wish I had a linux equivilent (monodevelop has SOOOOOOOO far to go). The only thing I hate hate hate hate (x1000) is it's lousy integration with source safe when it comes to ASP.net projects. Ever try moving a web project from one location to another? Or try to get a un-source controlled copy of your project. Good luck, it's possible but excruciatingly painful.

If you are using Visual Studio and doing any C# coding at all, you need to check out Resharper, from JetBrains... http://www.jetbrains.com/resharper/ [jetbrains.com]. I frankly don't know how anyone lives without it (or at least something similar).

Version 2.0 (due out late this year) will also support 2005, Visual Basic, and ASP.Net coding

Yes, because GOD KNOWS that if you type a standards compliant program into VC++, it won't compile.

(Okay, I know that it's not actually fully compliant. For instance, until 7.1, there was no support for partial template specialization. However, there is, to my knowledge, one fully compliant compiler+library implementation, and VC++ is as good as most now.)

I tend to work on code in Visual Studio 6 at least once a month that still works just fine here, ~10 years after its release.

But even when it comes to VS2003, last time I checked C# and.NET for example were based on EMCA standards, standards which have been implemented for use under Linux, MacOS and others, all making it possible for you to build an application in VS2003 and have it run on other systems.

For making non-standards-compliant, non portable, code that wont work in 4 years.

Erm... We write highly portable libraries in C and C++ at work. They have to compile on Windows, Linux, Solaris, HP-UX, AIX, MacOS X, and often under several different toolsets on each OS.

Our whole dev team is free to develop using whatever software we find helpful. We have GUI guys and CLI guys, Windows guys and Linux guys, emacs guys and vi guys, etc.

The one thing almost everyone has in common is that they use Visual C++ as their primary IDE. That's not because we're ill-informed or haven't tried the alternatives, it's because most of us think it's the best IDE available to help us do our jobs.

I think you missed the point of the OP.. it appears they were eluding to msdn.microsoft.com, or the MSDN help files that ship with Visual Studio.

In the past, I didn't find either to be terribly useful, but (I hate to say it) Microsoft got it right this time. With MSDN for VS.Net, I actually find what I need in the documentation, rather than having to use google.

Only on/. would someone be dumb enough to cite sourceforge as a good example of a fully integrated help/documentation/examples/technical discussion/articles/books/advise system. Sourceforge is many things but if you look at 95% of the projects on it they have nothing whatsoever to do with quality code or documentation.

Pfft -- keep your personal insults under your rock and think about why I've cited these sites. There's obviously a huge philosophical difference between how and why Microsoft can create this all encompassing bundle versus the toolset that OS people tend to use...

I've been a Visual Studio user for a long time now (both VS.NET and previous versions all the way back to 4.x). Visual Studio is pretty good but it's still not even close to Eclipse [eclipse.org]. Everything you like in VS.NET has been in Eclipse longer, is much more polished and gives you more power all around (customizable).

And as to the parent troll about Microsoft documentation, well that might have been true ages ago I find that most Windows API stuff is easy enough to find on MSDN, the documentation for.NET is ver

Yeah, because that happens...hm, never. I use both OS X and Windows XP and prefer OS X, but I have to say that I've had to hard reboot my OS X machine more than my WinXP machine and the WinXP machine being my development machine has more junk on it, while I keep my OS X machine clean of ANY non-Apple kernel extensions as well as other hacks into the system (i.e. no APE).

I've been on a few teams here at MS, and I must say that the source isn't that hard to get too. Now getting WRITE permissions too it is a pain, but right now I can see all the source to SQL, most of the source to the CLR and VS, some of office, some Windows, and I'm sure anything else could be gotten by just asking. (if it exists... I was looking for diamond.exe source a couple weeks ago to fix an AV we keep getting and apparently no one has compiled that thing since '96 and we couldn't find it.)

I shake my head and marvel...poor, closed-minded souls who se nothing but an MS product and think they are on the top of the world for ridiculing it.*sigh* The trolls do rush to these threads. Meanwhile we who actually try things before denigrating them have found an extremely capable IDE, enjoying the capability to code in/edit Ada, APL, ASml, Caml, Cobol, Delphi, Forth, Eiffel, Fortran, Haskell, Lisp, Lua, Mercury, Mixal, ML, Mondrian, Nemerle, Oberon, Pascal, Perl, PHP, Prolog, Python, RPG, Ruby, Scheme,