Visual Studio 2005 Profiles and a Few Tweaks I like to Make
One of the new features in VS 2005 is the support for “profiles” in the IDE. Profiles provide the ability to define pre-set defaults for options, menus, key-bindings, and command-bars across the tool-set. VS 2005 ships with several built-in profiles out of the box including: VB, C#, C++, Web, Test, and a General Development Settings similar to 2003. When VS launches the very first time it prompts a user to pick which of these profiles to use by default (note that you can build all app types and even use all languages regardless of which profile you pick).
If you ever want to change or reset your profile, you can select the Tools->Import and Export Settings menu option. It will then walk-you through a wizard where you can export or import settings to/from others (these are saved as XML files that you can ship around to work colleagues or friends). If you select the “reset all settings” radio button in this dialog, it will let you nuke and re-pick your default profile from scratch (for example: to re-pick the C#, VB or Web one by default).
There is bound to be lots of debate as to which profile is best, and why different options are set differently in whichever profile. The good news is that once you pick a profile, you can tweak it however you want to make it “perfect” (where perfect = what you personally think is right).
I’ve seen a few common questions on forums about profile tweaks (how do I make it do xyz) that I thought I’d call out in case you were interested:
Some Common Profile Tweaks and Optimizations:
Enable the output window to show up on build.
By default, the C# profile doesn’t show the build output window when you start a build (instead you need to manually show it). I personally like to see the build output window always show up so that I can better track progress (note in Web Projects it will now list each directory as it builds them – so you can quickly see which directories are getting re-built when dependencies change).
To enable this by default, select the Tools->Options menu item. Then under Project and Solutions->General select the “Show Output Windows when Build starts” checkbox.
Note that this option is enabled by default with the web profile.
Show MSBuild Output Verbosity “
By default, the C# and Web profiles send only “minimal” MSBuild information to the output window. You can configure additional levels of output information by selecting the Tools->Options menu item. Then under Project and Solutions->Build and Run you can select the MSBuild project verbosity dropdown to be: “Quiet”, “Minimal”, “
I personally like “Normal”, since it gives me build times for projects, and is also explicit about when/where files outputs are updated and to where. This is very useful when you have pre/post actions and are trying to track down when they are firing and what impact they are having.
Here are two samples showing the output window differences between the two settings:
Minimal Output:
------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\ClassLibrary1.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
ClassLibrary1 -> C:\Documents and Settings\Scott\My Documents\Visual Studio 2005\Projects\webtest\ClassLibrary1\bin\Debug\ClassLibrary1.dll
Normal Output:
------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
Build started 10/20/2005 9:24:41 PM.
Target CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\ClassLibrary1.dll /target:library Class1.cs Properties\AssemblyInfo.cs
Compile complete -- 0 errors, 0 warnings
Target CopyFilesToOutputDirectory:
Copying file from "obj\Debug\ClassLibrary1.dll" to "bin\Debug\ClassLibrary1.dll".
ClassLibrary1 -> C:\Documents and Settings\Scott\My Documents\Visual Studio 2005\Projects\webtest\ClassLibrary1\bin\Debug\ClassLibrary1.dll
Copying file from "obj\Debug\ClassLibrary1.pdb" to "bin\Debug\ClassLibrary1.pdb".
Build succeeded.
Time Elapsed 00:00:00.21
The difference is subtle between these two settings, but I think very useful. Notice how with the minimal output you can’t tell whether the assembly was updated (note that it won’t be updated if no changes were made to the project), whereas with normal output it is clearly called out. Normal output also shows build-times per project.
Track Active Item in Solution Explorer
One feature that was on by default with VS 2003 that a lot of people find useful was the ability to see the current document icon highlighted in the solution explorer as you moved around from document to document (it will also scroll the solution explorer so that the document is in view). This can be useful when you have deeply nested content in sub-folders and want to see the current document’s relation to others.
By default, the C# profile has this disabled, while the Web profile has this on.
To enable this feature in the C# profile, select the Tools->Options menu. Under Projects and Solutions->General select the “Track Active Item in Solution Explorer” checkbox.
Build Configuration Manager Dropdown in Toolbar
VS supports the concept of build configurations. For example: you can configure different settings for “debug” and “release” configurations (which projects build, etc) – as well as define your own (for example: staging, test, deployment, etc). Note that the new Web Deployment Project solution my team is shipping in a few weeks will let you do some really cool things with this and VS 2005 web projects (including the ability to dynamically replace configuration settings like connection-strings as part of which build configuration you pick).
You can configure which configuration in VS is the “active” one by selecting the Build->Configuration Manager menu item. This will bring up a modal Configuration Manager dialog with a drop-down to let you pick the active one. With the C# profile applied, you can also select the current configuration via a configuration drop-down located in the standard toolbar (this makes switching really fast – and was there by default with VS 2003). This drop-down is not present in the VB or Web profile by default.
To enable it in the VB or Web profile, select the Tools->Customize menu item. Click on the Commands tab in the dialog that comes up. Select the “Build” item in the Categories list box, and then scroll down to the very bottom of the Command list-box where you’ll fine the “Solution Configurations” list item. To add it into one of the IDE toolbars, you need to click it and then drag and drop it to the toolbar in the IDE location you want to add it to. (editorial note: this completely fails the “intuitive and discoverable sniff test” – but was actually the same behavior in past versions of VS).
Hope these suggestions help. As you’ll discover as you start to wade through the options dialog, there are literally thousands of tweaks you can make.
Scott