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 “Normal:

 

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”, “Normal”, “Detailed”, and “Diagnostic”. 

 

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

13 Comments

  • I don't know the appropriate venue to voice this question, so forgive me if you don't know or can't point me in the right direction.



    In VS 2003, while looking at an .aspx/.ascx file you could switch to the codebehind by pressing F7; then, to get back to the code front, you could press Shift+F7.



    In 2005, from code front to codebehind works as expected, but there doesn't seem to be a way to get to the code front from the codebehind WITHOUT switching to "Design View". I even toyed with writing a macro to do it



    something like:

    Sub SwitchToSourceView()

    DTE.ExecuteCommand("View.ViewDesigner")

    DTE.ExecuteCommand("View.ViewMarkup")

    End Sub



    But even that flickered the Design View.



  • Hmm, I'm using the "General Development" profile and everything listed is already on, with the exception of Build Output Verbosity 'Normal'..



    Just FYI!



  • Guess I should write all this down, I'm still waiting for the product to be released...



    Does it work with Sharepoint and MCMS now?



  • I would like to congratulate of all developers of asp.net 2.0 team. I just download full version of asp.net and it works very exellence, even with my "curved programms" that didn't work with beta version before.

    Nice!!!!

  • Jacob, you can go to Tools | Options | Environment | Keyboard, search for the command named View.ViewDesigner, and assign it SHIFT+F7 for the text editor.

  • nice article, your blog rocks.

  • this is awesome. everything u need in VS, find it first here.

  • Hi Hayedid,

    If you click the "Local IIS" tab when opening a website, it will list all web-sites currently configured in IIS. If you've mapped a sub-domain to IIS and configured it that way, then you can just select it via that dialog and open it from there.

    Hope this helps,

    Scott

  • Is there a way to use VS 2005 on an IIS server that doesn't have front page extensions installed?

    CB

  • Hi CB,

    Yep - you can use IIS with VS 2005 without needing FrontPage Server Extensions.

    Here is a blog post that covers it more: http://weblogs.asp.net/scottgu/archive/2005/08/23/423409.aspx

    Hope this helps,

    Scott

  • One thing about VS 2005 that drives me insane is that if you have >1 CPU, the output logs for umanaged compiles are all screwed up. I can understand that unrelated compile/link are sent to different CPU's, but YOU CAN'T READ THE BLOODY LOG FILES to determine where the errors occured (i.e. which project).

    In the IDE you have to (every time) switch, in the output window, from 'Build' to 'Build Order' to see a sequential build process. I'd like to see Build Order as a configurable default.

    Most of our builds are done unattended, so we have to look at log files. When something doens't compile, you can't figure out what project it occured in - especially if you have 4 CPU's! Ergh.

    Sorry, had to vent. I feel better now.

  • In VS 2003 at the end of the build it changed to a nice listing of build errors. That was really nice for resolving compile errors. Now (as far as I can see) you just have to scroll through the log looking for errors. I have a large project (90 modules) so this is really a pain. Is there a better way to just get to the list of errors?

  • Hi GoldenM,

    You shouldn't have to scroll through any log files. Instead, bring up the error list, and you should see any errors that occured listed within it (just like VS 2003). Are you not seeing this?

    Thanks,

    Scott

Comments have been disabled for this content.