Visual Studio .NET


Let's take a quick look at what these extensions can do for you. As you can expect from me I'm only interesting in the Web Part section of this product. For all other options check out this blog called Walkthrough - Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions. About handling Web Parts, Mart Muller wrote an excellent blog about how you Create a SharePoint 2007 webpart step by step. With the new extensions you only have be aware of the steps Mart wrote, but you don't have to execute those anymore.

After installing the product you have the ability to select a Web Part project from the SharePoint project types. Web Parts were first introduced in Windows SharePoint Services v2. The concept was so compelling that the model was improved and added to the second generation of ASP.NET: ASP.NET 2.0. This wasn't the only addition to ASP.NET 2.0. Other improvements and enhancements allowed the Windows SharePoint Services team to revamp their underlying architecture that resulted in it being rebuilt on top of ASP.NET 2.0 (previously, WSS v2 had it's own rendering engine).


After selecting this project, it will create a base project with a template file as shown below. As you can see it will inherit from the ASP.NET 2.0 WebPart class (System.Web.UI.WebControls.WebParts.WebPart), but you can also build Web Parts that inherit the WSS v3 WebPart class (Microsoft.SharePoint.WebPartPages.WebPart). To decide from which Web Part you should derive check Creating Web Parts in Windows SharePoint Services. In most cases you could stick to default settings. As we can expect from a custom control we do need to set it's rendering. After doing so, check you settings of the project.

    1 using System;

    2 using System.Runtime.InteropServices;

    3 using System.Web.UI;

    4 using System.Web.UI.WebControls.WebParts;

    5 using System.Xml.Serialization;


    7 using Microsoft.SharePoint;

    8 using Microsoft.SharePoint.WebControls;

    9 using Microsoft.SharePoint.WebPartPages;


   11 namespace My_First_Extension_Web_Part

   12 {

   13     [Guid("e17149f4-56e6-4c5d-909c-3cec0a1d0f27")]

   14     public class My_First_Extension_Web_Part : System.Web.UI.WebControls.WebParts.WebPart

   15     {

   16         public My_First_Extension_Web_Part()

   17         {

   18             this.ExportMode = WebPartExportMode.All;

   19         }


   21         protected override void Render(HtmlTextWriter writer)

   22         {

   23             // TODO: add custom rendering code here.

   24             writer.Write("My First Extensions Web Part!");

   25         }

   26     }

   27 }

The extensions introduced a new Tab for a SharePoint Solution. In this tab you can set the settings for its solution, the feature and even the element itself. This will give you the ability to easilly set these settings without creating additional files. Besides this extra tab, the project will also sign this assembly with a strong name key, so it can be easily added to the GAC. Note: This key is for every newly created project on the same machine identical.

In the next screen dump you can see the project is deployed to the web server, which contains SharePoint. It will create a *.wsp file, which will automatically add the Web Part to the GAC, mark your Web Part as safe in the web.config of the SharePoint site, populate your Web Part gallery and reset its server.  

------ Build started: Project: My First Extension Web Part, Configuration: Debug Any CPU ------

C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.dll" /reference:C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.dll /reference:C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Web.dll /reference:C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Xml.dll /debug+ /debug:full /keyfile:PropertiesTemporary.snk /optimize- /out:"objDebugMy First Extension Web Part.dll" /target:library PropertiesAssemblyInfo.cs "My First Extension Web PartMy First Extension Web Part.cs"


Compile complete -- 0 errors, 0 warnings

My First Extension Web Part -> D:ProjectsWebPartsMy First Extension Web PartbinDebugMy First Extension Web Part.dll

------ Deploy started: Project: My First Extension Web Part, Configuration: Debug Any CPU ------

------ Generate My First Extension Web Part.wsp file and setup batch file------

Creating solution ...

Operation completed successfully.


Creating setup batch file ...

Operation completed successfully.


------ Add and deploy My First Extension Web Part.wsp to the SharePoint ------

Adding solution ...

Operation completed successfully.


Deploying solution ...

Operation completed successfully.


------ Activate features in solution if necessary ------

Activating feature My_First_Extension_Web_Part ...

Operation completed successfully.


Restarting IIS ...

 After deploying you can add your newly created web part to your SharePoint site like you've done thousands of times before.

It's good to have these new extensions for Web Parts. Offcourse you still have to know the steps mentioned by Mart, but you don't have to follow them exactly anymore. I personally think it's a great effort of the SharePoint team and like to thanks you guys.


Eilene Hao, Program Manager for SharePoint Workflow finished her complete blog series about developing SharePoint workflows in Visual Studio (VS). Lots of people are asking a lot of questions about this issue and a lot of them seem to have common points of confusion. With so much information out there, it’s sometimes hard to see the big picture amidst details and know what’s really important or how to put all the pieces together. 

She created a more cohesive guide of key concepts, and converted it to a blog series that she posted Microsoft SharePoint Products and Technologies Team Blog. She started with some fundamental workflow terminology and critical architectural concepts, then go over the steps for developing a workflow, covering the most common questions and points of confusion, and noting pitfalls and tips for success along the way. Understanding the material in this series will hopefully equip you with the right tools and knowledge to solve or work around a lot of problems that you encounter.

Note that this is not a replacement for the SDK, and you should still look there for the finer details. She highlighted the major concepts so that you have a sense of what to look for.

Developing Workflows in VS: Part 1 - Workflow Objects and A Crash Course on Mechanics

Developing Workflows in VS: Part 2 - Planning Your Workflow: Two Things to Keep in Mind

Developing Workflows in VS: Part 3 - Five Steps for Developing Your Workflow

Developing Workflows in VS: Part 4 - Design and Bind Your Forms

Developing Workflows in VS: Part 5 - Code Your Workflow

Developing Workflows in VS: Part 6 - Deploy and Debug your workflow

Developing Workflows in VS: Part 7 - Summary and Final Thoughts

Perfect set of articles about developing SharePoint workflows in VS. I'll hope the team will give us more blog-series like this.


1 Comment

VS Service Pack 1
The Visual Studio 2005 Service Pack 1 Beta Program closed on October 30, 2006. More than 10,000 users participated in this program and they have reviewed over 350 bugs and suggestions. The Visual Studio 2005 SP1 Beta and Visual Studio 2005 TFS SP1 Beta are still available for download on the Microsoft Download Center. After closing the program I hope they will soon release the gold version.

Visual Studio 2005 Service Pack 1 will focus on addressing product issues reported since the release of Visual Studio 2005. Hotfixes included in the Beta Service Packs:

KB Article Fix Description
KB898904 Update to the Web Project Conversion Wizard in Visual Studio 2005
KB909350 FIX: You receive LNK2001 and LNK1120 error messages when you use the Vcbuild.exe command-line tool to build a Visual C++ solution
KB910275 FIX: The customized color code marker that is actually added may differ from the customized color code marker that you try to add in Visual Studio 2005
KB910832 FIX: The IDE stops responding when you work with nested generic types in C# in Visual Studio 2005
KB911281 FIX: A native application takes a long time to start when you try to debug the application by using Visual Studio 2005
KB912019 FIX: You may receive an error message when you rebuild a solution and try to view a Windows Form in Design view in Visual Studio 2005
KB913377 FIX: IntelliSense may stop working, and Visual Studio may crash, when you try to open a large Managed C++ project in Visual Studio 2005
KB913432 FIX: The IDE stops responding when you build a project that generates lots of text in the Output window in Visual Studio 2005
KB913940 An attributed ATL-based COM server unexpectedly exits in Visual Studio 2005
KB913951 FIX: The browser may stop responding when you scroll through a Visual J# 2005 Web page that contains a J# Browser Control
KB913996 FIX: Error message when you use the debugger in Visual Studio 2005 to debug an MFC class library application: "Managed Debugging Assistant 'Loader Lock' has detected a problem in ''"
KB915038 FIX: You may receive Visual Basic compiler error messages when you are developing a Visual Basic 2005 project in Visual Studio 2005
KB915110 FIX: Visual Studio 2005 may stop responding when you build a Web application project that is checked out of Visual SourceSafe
KB915364 Update to support Visual Studio 2005 Web Application Projects
KB915418 FIX: An access violation may occur when you try to run a Visual C++ 2005 application that contains OMG CORBA IDL code
KB915423 FIX: Error message when you use certain code patterns that involve the IDisposable interface in the Visual Studio 2005 C++ compiler: "Fatal error C1001"
KB915781 FIX: You may receive an incorrect error message when you open a Visual Studio 2005 Tools for Office document
KB916632 FIX: All the applications that use the C run-time library may not start after you install Visual Studio 2005 and then you uninstall Visual Studio 2005 without restarting the computer
KB916688 FIX: Error message when you try to use the Visual SourceSafe 2005 LAN booster service together with Visual Studio 2005 on a server that is running Windows 2000: "Unable to use SourceSafe LAN service"
KB916769 FIX: The Visual Studio 2005 IDE stops responding when you work with a large Visual C++ .NET solution in Visual Studio 2005
KB916812 FIX: The report does not print the first time that you click Print when you try to print the report from the Report Viewer control in Visual Studio 2005
KB917036 FIX: The Visual Studio 2005 IDE may corrupt the deployment files for a Web Setup Project and for a Setup Project
KB917141 FIX: The position of the Properties window may not be saved after you exit Visual Studio 2005 on a dual-monitor system
KB917147 FIX: The Cole Property Page object of a Visual C++ application may be deleted when the Bound Property Changed function is invoked, and Visual Studio 2005 may unexpectedly close (crash)
KB917291 FIX: Custom build steps may not run when you add the custom build steps to a Visual C++ 2005 Win32 static library project in Visual Studio 2005
KB917327 FIX: Japanese, Chinese, or Korean characters in resource files may be overwritten by question marks after you convert a Visual C 6.0-based project to Visual Studio 2005
KB917452 FIX: You may experience performance issues when you use solutions that contain large Visual Basic projects in Visual Studio 2005
KB918373 FIX: The Atls.pdb file and the Atlsd.pdb file contain incomplete debugging information when you debug an ATL-based C++ application in Visual Studio 2005
KB918553 FIX: A floating-point exception may occur when an inline function in a C++ application returns an uninitialized floating-point variable in Visual Studio 2005
KB918559 FIX: You may experience slow performance and increased memory usage when you start the debugger for a Visual C++ project in Visual Studio 2005
KB919232 FIX: MS Project Work Item Publish Error
KB919280 How to rebuild the C++ STL library for Visual Studio 2005
KB919904 FIX: You may receive an error message when you try to build a Web project that references a .NET Compact Framework 2.0 assembly in Visual Basic 2005
KB920145 FIX: You may receive an error message when you consume an assembly that has an obfuscated generic type in Visual Studio 2005
KB920770 FIX: You may receive a "Fatal error C1902" error message and a solution build may fail when you try to use the AT command or a scheduled task to automate a build of a C or C++ project in Visual Studio 2005
KB920805 FIX: You may experience slow performance when you work with a Visual Basic solution that contains many projects in Visual Studio 2005
KB923147 FIX: Visual Studio 2005 exits unexpectedly when you try to edit an existing Data Table object or add a new Data Table object to the dataset that you are editing

TFS Service Pack 1

  • Version Control - WorkItem Tracking and Datawarehouse performance/scale improvements.
  • "Extranet support" - An ISAPI filter is implemented that will allow the intranet to use NTLM and integrated auth while the extra net uses basic auth.  This enables TFS to be more easily deployed in environments where people on the Internet need to be able to access TFS without having VPN.
  • WIT Custom Control support - This is a mechanism by which people can design work item forms that host custom controls.  The data behind the controls can either be persisted in WIT fields or elsewhere. 
  • Support for Office 2007 support (Project and Excel - no SharePoint 2007 support yet)

    Please don't try to install TFS with SharePoint 2007 at this point - it will not work.  Microsoft is working on SharePoint 2007 support for Orcas - it will not be in SP1.

  • Detailed Merge History - In V1 not all information was exposed from the server necessary to build all of the sophisticated change tracking tools we use internally that track the flow of changes through branches.  The server "summarized" merge history information too much and information was only approximated. SP1 includes a new web service method and object model API that allows access to the detailed information.  The new API is called QueryMergesWithDetails on the SourceControl object.
  • Separating the SQL Analysis Services Server - For more flexible deployment topologies you now can install Sharepoint on separate servers, SQL Named instances, Reporting services on separate servers and more.  SP1 has one small step in that direction by including the change necessary to support TFS using SQL Analysis Server installed on a separate machine. 

An other thing that caught my attention is is the DevDiv Hotfix Public Availability Pilot Program which is an initiative of the Microsoft team to help make the Visual Studio 2005 hotfixes more generally available. Of course you can download them, but you can also see that a hotfix exist and how to apply it if needed. Most hotfixes on the site aren't required if you are running the Visual Studio 2005 SP1 Beta.


You had to wait some time, but the team finally delivered the Visual Studio 2005 extensions for Windows SharePoint Services 3.0. This tools are for developing custom SharePoint applications: Visual Studio project templates for Web Parts, site definitions, and list definitions; and a stand-alone utility program, the SharePoint Solution Generator.

This Community Technology Preview (November CTP) of the Visual Studio 2005 Extensions for Windows SharePoint Services contains the following tools to aid developers in building SharePoint applications:

Visual Studio 2005 Project Templates

  • Web Part
  • Team Site Definition
  • Blank Site Definition
  • List Definition

Visual Studio 2005 Item Templates (items that can be added into an existing project)

  • Web Part
  • Custom Field
  • List Definition (with optional Event Receiver)
  • Content Type (with optional Event Receiver)
  • Module


SharePoint Solution Generator

  • This stand-alone program generates a Site Definition project from an existing SharePoint site. The program enables developers to use the browser and Microsoft Office SharePoint Designer to customize the content of their sites before creating code by using Visual Studio.


CopySourceAsHTML will give you an error while using it in a Microsoft Virtual PC (I'm probably the last Mohican whose using MS VPC, but that's mine problem). The exact message is "Requested Clipboard operation did not succeed".

Error message

While searching the Internet I found lots of people complaining about this error using all kinds of apps (including in MOC labs of Microsoft which use a VPC). For me this error only occurs during this add-in. In my last blog I already talked about debugging an add-in is easy, so I was ready to solve this problem.

Code is exponentially more readable when certain parts of that code are differentiated from the rest by using a different color text. Reading code in Visual Studio is generally much easier than trying to read code in an editor like Notepad.

Chances are you may have your own blog by now, or at least have spent some time reading them. Normally, when you try to post a cool code snippet to your blog it ends up being plain old text, which isn't the easiest thing to read. This is where the CopySourceAsHTML add-in comes in to play. This add-in allows you to copy code as HTML, meaning you can easily post it to your blog or Web site and retain the coloring applied through Visual Studio.

After installing the CopySourceAsHTML add-in, simply select the code you want to copy and then select the Copy Source as HTML command from the right-click menu. After selecting this option you will see the dialog box.

Options for CopySourceAsHTML

From here you can choose what kind of HTML view you want to create. This can include line numbers, specific tab sizes, and many other settings. Of course I use Jan Schreuder's style guide for the file style. This style creates an easy browsable frame inside your page

border-top: windowtext 1pt solid;
border-top-color: #CCCCCC;
padding-top: 1pt;
border-left: windowtext 1pt solid;
border-left-color: #CCCCCC;
padding-left: 1pt;
border-right: windowtext 1pt solid;
border-right-color: #CCCCCC;
padding-right: 1pt;
border-bottom: windowtext 1pt solid;
border-bottom-color: #CCCCCC;
padding-bottom: 1pt;
width: 100%;
overflow: auto;
background-color: #F5F5F5;

Jan's File Style

After clicking OK, the HTML is saved to the clipboard. For instance, suppose you were starting with the following code snippet inside Visual Studio:

namespace mynamespace.Service
public class MyService : System.Web.Services.WebService
public string Foo()
{ ... }
public void Bar(string s1, string s2)
{ ... }

Normal Copied Code

After you select Copy As HTML and configure the HTML to include line numbers, this code will look like this.

namespace mynamespace.Service
   public class MyService : System.Web.Services.WebService
     public string Foo()
     { ... }
     public void Bar(string s1, string s2)
     { ... }

CopySourceAsHTML Code

Modify CopySourceAsHTML  
Reading this blog Copying Visual Studio code snippets to the clipboard as HTML I found a nice conversation between the owners of "FormatToHtml macro" and "CopySourceAsHTML". When I was reading this configuration I saw one of my blogger's Bryant Likes also mentioned the error I described. On another forum Requested Clipboard operation did not succeed, people were complaining about the same error as well. While reading all the post, someone mentioned it could be that the clipboard is locked for the current thread, which can be solved by creating a new thread. I introduced the new thread into the add-in and it's working perfectly. In the next frames I will show you the modifications.

namespace JTLeigh.Tools.CopySourceAsHtml
    internal static class Clipboard
        public static string GetRtf()
            if (!System.Windows.Forms.Clipboard.ContainsText(TextDataFormat.Rtf))
                return null;
            return System.Windows.Forms.Clipboard.GetText(TextDataFormat.Rtf);
        public static void SetHtml(string html)

Clipboard.cs original source

namespace JTLeigh.Tools.CopySourceAsHtml
    internal static class Clipboard
        private static string _rtf = null;
        public static string GetRtf()
            return _rtf;
        private static void GetClipboardPrivate()
            if (!System.Windows.Forms.Clipboard.ContainsText(TextDataFormat.Rtf))
                _rtf = null;
            _rtf = System.Windows.Forms.Clipboard.GetText(TextDataFormat.Rtf);
        public static void StartThread()
            Thread thread = new Thread(new ThreadStart(GetClipboardPrivate));
        public static void SetHtml(string html)

Clipboard.cs modified source

                    rtf = Clipboard.GetRtf();
                    if (rtf == null)
                        MessageBox.Show(Resources.NoRtfDataOnClipboardMessage, Resources.NoRtfDataOnClipboardCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                catch (ExternalException)
                    MessageBox.Show(Resources.UnableToAccessClipboardMessage, Resources.UnableToAccessClipboardCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);

Connect.cs modified source

Compile the new code and overwrite the current CopySourceAsHtml.AddIn in Documents and Settings<user name>My DocumentsVisual Studio 2005Addins.

Anything that makes it easier to share and understand code benefits all of us as it means more people will go to the trouble of sharing knowledge and learning from each other. CopySourceAsHTML was written by Colin Coller and can be downloaded from I will notice Colin to show him mine solution to use his add-in in Virtual PC environment. Meanwhile I will ask the moderator of this site, also a fan of this add-in to post a compiled dll, so other users can easily use this add-in in a VPC.

You can download an already modified DLL here.


In Visual Studio .NET 2002 and Visual Studio .NET 2003, you were required to register add-in assemblies with Windows as COM components by using the Assembly Registration Tool (regasm.exe). Also, you were required to register the add-in with Visual Studio by using keys in the Windows registry before the add-in would appear in the Add-In Manager.

These steps have changed in Visual Studio 2005. You no longer need to register the .NET assemblies with Windows by using regasm. Instead, you simply place the assembly .DLL file into a specific directory along with an XML file that has an .Addin file extension. This XML file describes the information that Visual Studio requires to display the add-in in the Add-In Manager. When Visual Studio starts, it looks in the .Addin File location (listed below) for any available .Addin files. If it finds any, it reads the XML file and provides the Add-In Manager with the information needed to start the add-in when it is clicked.

This simplified registration method allows XCopy-style installations for managed code add-ins. If you put all the files in the right place, then your add-in works just fine. Also, its use of commented XML to define the registration settings for add-ins allows the information to be more easily understood and edited than registry keys.

Application Configuration

However for debugging an add-in you have to one other thing. In the Debug tab you have to select an external program which will start a new development environment . This application can handle command-line arguments. The argument for resetting an add-in is resetaddin which expects a full class name.

Debug Configuration

The following is an example of a complete .Addin XML file. The .Addin file is usually placed at Documents and SettingsAll UsersMy DocumentsVisual Studio 2005Addins or Documents and Settings<user name>My DocumentsVisual Studio 2005Addins. The Assembly node (in bold) specifies the location of the (debug) add-in binaries. This field can be set to a local path, a network path, or a valid URL.

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="">
    <Name>Microsoft Visual Studio</Name>
    <Assembly>[Path to add-in]w00t.dll</Assembly>

w00t - For Testing.AddIn

It's really easy to debug an add-in these days. The reason why I want to show you this cause one of mine w00test add-ins doesn't work in mine virtual PC images. I hope to bring you the good news tommorow if I was able to extend this add-in, so it can work on a VPC as well.

1 Comment

The Microsoft Data Dude Team is proud to announce that CTP7 (2.0.50727.222) is already here. I was only able to use CTP6 for two weeks since Microsoft released it and they already updated their product again. CTP7 of Visual Studio Team Edition for Database Professionals aka "Data Dude" can be found here. This version as GertD told us is going to be the last CTP before the release of the full version. He also mentioned all the changes carried out in CTP7.

Setup and About screen

Several people already talked about the features and possibilities of the product. Some of them include:

  • Schema and Data Comparison
  • Data Generation
  • Enhanced T-SQL Editor
  • Refactoring
  • Unit Testing
  • Database Deployment

The nice thing of this Visual Studio product, database developers are finally able to work like other programmers. Extreme Programming is useful and through Visual Studio projects and source control more developers will be able to work on a single database. Unfortunally its only possible to create a SQL Server 2000 and 2005 database project. Maybe other 3rd party companies can extend these possibilities. You can also ask yourself the question "Are there any other databases" ;-).

Here are some screen dumps of the product.

Sulution Explorer and Schema View

Refactoring a script

Unit testing a script

I can hardly wait till their RTM will be released. Team Edition for Database Professionals is like an add-on for Visual Studio Team Edition. I don't understand why they didn't create all team editions as add-ons. Now you always have to use a complete iso-images to only add a few extra tools for testing (for Testers) or modelling (for Architects)

In this blog you can read The What, The Why, The How of Visual Studio Team Edition for Database Professionals.