Dotneteers.net
All for .net, .net for all!

LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP

I spent this week in Los Angeles at the PDC 2008. It was seven years after my last PDC experience in 2001, so I was very happy to attend again. During the whole week and after returning home I was very excited about the new announcements and technologies I could meet. Windows Azure, Oslo, Dublin, Silverlight 2, .NET FX4, VS 2010 were the most frequently used buzzwords during the conference.

As a VSX guy, please allow me that even Windows Azure or Oslo seems more esoteric, I still focus on the CTP of the new version of Visual Studio named as Visual Studio 2010 and its SDK called VS SDK 2010. In this article I will share my experiences playing with these CTPs.

The last day of PDC also gave me some more spin: I attended at Tim Wagner’s session about Visual Studio Extensibility that demonstrated some cool new features. I immediately decided to try them…

How to obtain the VS 2010 CTP?

I was lucky to attend at PDC, not only because I was the witness of great sessions and announcements but also because attendees were given a mobile hard disk full with useful install kits and materials. As a part of these kits, a virtual machine image of VS 2010 CTP was also distributed, so I did not have to download it from the web.

In this blog post (and maybe in future posts) I will use this virtual machine to play with VS 2010. If you did not attend at the PDC, you can download this virtual machine from here using your Live ID. Please, be prepared to download more than 7 GBytes, so use a good download manager program you rely on.

After downloading and decompressing the files, you get the following ones:

File

Description

How to use Visual Studio 2010 CTP.docx

Documents describing how to setup and start your virtual machine to play with VS 2010. I suggest opening the .mht file as it saves memory. Opening the .docx file may allocate more memory just to prevent you to set up your virtual machine.

How to use Visual Studio 2010 CTP.mht

VisualStudio2010CTP.vhd

The virtual hard disk file for the VS 2010 image

VisualStudio2010CTP.vmc

The virtual hard disk settings file

Follow the instructions in the .mht or .docx file (they contain the same text) to set up the virtual machine. Instructions say that you need 75 GB of free HDD capacity. My experiences show that if you do not use TFS and SQL Server, 40 GB free space is enough.

Please note that the VM does not have any network connection, I suggest you not to change this setting. However, it means that you will not have direct access to internet from the VM. If you face with any URL, copy it and use your physical machine’s browser to navigate to the page behind the URL.

Tuning Your VM

If you want to set up your virtual machine to run quicker and be more responsive, I have a few suggestions to you:

—  The initial RAM of the virtual machine is set to 1 GB. If you have more than 2 GB of RAM in your physical machine, add some more RAM to your virtual machine accordingly (keep at list 1 GB for the OS).

—  If you do not want to play with the TFS features, stop the following services and set their startup state to Manual as doing so may save 20% of the virtual machines memory that worth a lot in this case.

—  Visual Studio Team Foundation Background Job Agent

—  Visual Studio Team Foundation Build Service Host

—  Visual Studio Team Foundation Server Task Scheduler

—  Windows SharePoint Services Tracing

—  Windows SharePoint Services Administration

—  World Wide Web Publishing Service

—  SQL Server (MSSQLSERVER)

—  SQL Server Agent (MSSQLSERVER)

—  SQL Server Analysis Services (MSSQLSERVER)

—  SQL Server Reporting Services (MSSQLSERVER)

—  If you do not plan to play with SQL Server, you can stop the SQLEXPRESS instances and set them to Manual startup.

—  By default the desktop wall paper is set to solid black color. Do not use a photo as wallpaper, if you are not satisfied with the black background, select another solid color.

—  Restart your virtual machine after the changes.

Start Playing with Visual Studio 2010

You can find the VS 2010 CTP in the All Programs group of the Start menu under the Visual Studio 2010 folder. I suggest creating a shortcut for devenv.exe on the Quick Launch Toolbar.

After starting Visual Studio 2010, you should wait about 10 to 20 seconds while it starts. You will definitely recognize this version by its distinguishing mark: a new Start Page is displayed.

This Start Page is fully customizable; there is a XAML file behind it. By changing this XAML file (with a few constraints about its structure) you can create your own Start Page helping you in the context you work.

When you click on the CTP Walkthroughs icon in the Welcome area, VS opens the folders where you can find useful information about walkthroughs that give you a basic overview about VS 2010.

When you go into the Visual Studio folder then to the SDK folder you’ll find there the VsSDK_sfx.exe program that is the installer of VS SDK 2010. By double-clicking on this file you can start the installer. I suggest you to install VS SDK 2010, as we will use it in the subsequent posts to become familiar with the new VS SDK features. The installer will finish its work in a few minutes and you then you have the next (CTP) version of the SDK on your VM.

Running the first Visual Studio 2010 Extensibility Sample

Visual Studio 2010 contains a brand new editor written in managed code using WPF technology. This editor opens totally new extensibility opportunities that can be used in simpler way than it could have been done with any other former VS versions.

Open the TextColoringSample.sln solution file that can be found under the Visual Studio\Samples\TextColoringSample folder. Add a new text file named Sample.txt to the project and type the “this is a text with word body” line. When you select this line in the editor you can see the selection rectangle has a solid blue outline and a gradient fill color indicating that WPF is used for the editor:

The TextColoringSample will demonstrate some basic features of the editor extensibility. It adds some new functionality to the editor that sets the foreground color of words “this” and “body” to red in any text documents in the VS IDE.

In this post I do not dig into the code, instead I show you the brand new mechanism of deploying and removing editor extensions.

Build the project and after the successful build close Visual Studio. Now we are going to deploy this simple extension. Run the DeployTextColoringSample.cmd file that can be found in the same folder as the solution file. This batch file copies the TextColoringSample.dll file (the binary assembly we have just built) into the Common7\IDE\Components folder under the Visual Studio 10.0 installation folder. Visual Studio uses this folder to discover extensibility components.

Now, start Visual Studio 2010, open the TextColoringSample solution again. You can recognize the effect of our small extension in the coloring of the Sample.txt file:

The “this” and “body” words are set to red. If you go into the Colorer.cs file you can also observe these words are in red. Now let’s play a little bit around the coloring! Search for the MyWordListProvider class in the Colorer.cs file and add the word “with” to the highlighted line as indicated in the following code extract:

internal sealed class MyWordListProvider : IWordListProvider

{

  // This is a list of words that we want to classify (color red) in .txt files.

  public IEnumerable<string> GetWords()

  {

    return new List<string>(new string[] { "this", "body", "with" });

  }

}

Now search for the WordClassificationFormatDefinition class and add the highlighted line to its body:

internal sealed class WordClassificationFormatDefinition :

  ClassificationFormatDefinition

{

  public WordClassificationFormatDefinition()

  {

    ForegroundBrush = Brushes.Red;

    BackgroundBrush = Brushes.Yellow;

  }

}

As you guess, now our little extension colors three words and sets their background color to yellow. Deploy again the extension by closing Visual Studio, running the DeployTextColoringSample.cmd file and then starting Visual Studio again. The changes can be immediately observed:

Extension Deployment Background

In Visual Studio 2010 a new extension model appears using the Managed Extensibility Framework. This framework uses a new concept to define, implement and deploy discoverable extensions. The TextColoringSample editor extension uses this concept. In the final version of Visual Studio we do not have to stop and restart the IDE for deploying the extension component: as soon as it is copied into the directory watched by the IDE, the component goes functional. No registration, no configuration just simple copy is required.

At the PDC Tim Wagner used a newer VS 2010 build where he did not stop the IDE during the extension copy operation, so I really hope, this feature will not be a victim of feature cut in a later version.

Managed Extensibility Framework (MEF) has been officially declared as one of the basic mechanisms in the future for extending VS in a discoverable way. Right now this technology is also in CTP state, you can obtain more information about it from here. MEF seems to be the part of the new .NET 4.0 framework that is released together with Visual Studio 2010.

Because knowing MEF is indispensable to create VS editor extensions, in later posts I am going to treat it in details.


Posted Nov 03 2008, 10:14 AM by inovak
Filed under: , ,

Comments

Visual Studio Hacks wrote Visual Studio Links #85
on Sat, Nov 8 2008 17:30

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. SlickEdit Versioning Toolbox is a Visual Studio extension that gives version control like functionality on your local workstation

Start Page | AllGraphicsOnline.com wrote Start Page | AllGraphicsOnline.com
on Fri, Mar 25 2011 7:42

Pingback from  Start Page | AllGraphicsOnline.com

Novák István szakmai blogja wrote VS 2010 SDK: A TextColoringSample működése
on Tue, Aug 7 2012 23:46

A Visual Studio 2010-es változatában a szerkesztő már .NET kódban íródott

Novák István szakmai blogja wrote Első tapasztalataim a VS 2010 CTP-vel
on Tue, Aug 7 2012 23:47

Hazatérve a PDC-ről, már a hétvégén nekiláttam a VS 2010-et

clomid no prescription wrote re: LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP
on Mon, Feb 25 2013 15:28

I value the article post.Really thank you! Much obliged.

Fifa 15 Coin Generator wrote Fifa 15 Coin Generator
on Thu, Sep 18 2014 5:47

LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP - DiveDeeper's blog - Dotneteers.net

Game Of War Fire Age Hack 2014 wrote Game Of War Fire Age Hack 2014
on Thu, Sep 25 2014 8:23

LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP - DiveDeeper's blog - Dotneteers.net

Game Of War Fire Age iPhone Hack wrote Game Of War Fire Age iPhone Hack
on Mon, Sep 29 2014 10:30

LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP - DiveDeeper's blog - Dotneteers.net

Fifa 15 Ultimate Team Glitch wrote Fifa 15 Ultimate Team Glitch
on Wed, Oct 15 2014 10:52

LearnVSXNow! #37 - Meet Visual Studio 2010 and the New VS SDK 2010 CTP - DiveDeeper's blog - Dotneteers.net