Blog

Versionable Serialization Improvements in 2.0

If you happened to be using the built-in serialization mechanism in .NET 1.0, you may have noticed that there is a problem with de-serializing objects serialized with earlier versions, even if the versions are binary compatible (strong name compatibility is optional).  Here’s the problem: Define a class decorated with the System.SerializableAttribute. Add a field or […]

Launching the ASP.NET Development Server from the command line

By default, Visual Studio 2005 does not run or debug web projects using IIS.  Rather, web sites are hosted with a new ASP.NET Development Server.  This web host environment dynamically selects a port and begins hosting the web site in a manner that is only accessible to the local host. The web hosting process is […]

Converting a class library to a VSTS Test Project

I recently wanted to convert a NUnit test project to a VSTS Test Project.  The steps are relatively simple but I did come across one un-intuitive point #4 below: Reference Microsoft.VisualStudio.QualityTools.UnitTesting.Framework. Change the using NUnit.Framework declaratives to using Microsoft.VisualStudio.QualityTools.UnitTesting.Framework. Search and replace the following: [TestFixture] => [TestClass] [TestFixtureSetUp] => [ClassInitialize] [TestFixtureTearDown] => [ClassCleanup] [SetUp] => [TestInitialize] [TearDown] […]

Nullable and the struct constraint in VS.NET Beta 2

In VS.NET 2005 Beta 1 it was possible to define a variable of type Nullable<Nullable<Nullable<int>>> number; and, therefore, int??? number; Nullable<T> only allows type parameters that are value types through the use of the struct constraint as follows: public struct Nullable<T> : IFormattable, IComparable, IComparable<Nullable<T>>, INullable where T : struct { // … } In […]

Registering a string of code as an apparent “delegate” listener

In my previous post I described how to provide custom validation code at runtime.  I register the code through a call to RegisterNameValidationCode().  One variation on this is to provide a += operator to register the code so that it looks as though I am registering a delegate. bool exceptionFired = false; Person person = […]

Changing the default item templates in Visual Studio 2005

If you use the Add Item menu to insert a file into your Visual Studio 2005 project, the resulting file may not meet your needs by default.  However, these default files can be modified to suit your fancy. The item templates directory is located in “%ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates” by default.  It contains a folder […]

Accessibility of new types in Visual Studio 2005

One subtle but noteworthy change in Visual Studio 2005 from Visual Studio 2003 is the accessibility modifier on new types.  In Visual Studio 2005, the default accessibility is internal rather than public.  (This is true from the Add Item menu but not from the Add File menu because they are generated from different templates.)  For […]