Archives

Archives / 2010 / March
  • How To: Automatically Remove www from a Domain in IIS7

    I recently moved the DevMavens.com site from one server to another and needed to ensure that the www.devmavens.com domain correctly redirected to simply devmavens.com.  This is important for SEO reasons (you don’t want multiple domains to refer to the same content) and it’s generally better to use the shorter URL (www is so 20th century) rather than wasting 4 characters for zero gain.

    My friend and IIS guru Scott Forsyth pointed me to his blog post on how to set up IIS URL Rewriting.  To get started, you simply install IIS Rewrite from this link using the super awesome Web Platform Installer.  You should get something like this when you’re done with the … more

  • ASP.NET MVC 2 and Windows Azure

    If you upgrade an Azure web instance to use ASP.NET MVC 2, make sure you mark the System.Web.Mvc reference as Copy Local = true.  Otherwise, your deployment will fail.  And you won’t get any good feedback from Windows Azure as to the cause of the problem.  So you’ll start searching the web for help, and perhaps you’ll stumble on this post, and you’ll realize that you didn’t set Copy Local = true on your System.Web.Mvc assembly reference in your ASP.NET MVC 2 web instance.  And you’ll  leave happy (or at least slightly happier) than when you came. That is all. more

  • Simple Branching and Merging with SVN

    It’s a good idea not to do too much work without checking something into source control.  By “too much work” I mean typically on the order of a couple of hours at most, and certainly it’s a good practice to check in anything you have before you leave the office for the day.  But what if your changes break the build (on the build server – you do have a build server don’t you?) or would cause problems for others on your team if they get the latest code?  The solution with Subversion is branching and merging (incidentally, if you’re using Microsoft Visual Studio Team System, you can shelve your changes and share shelvesets with others, which accomplishes many of the same things … more

  • Fix: SqlDeploy Task Fails with NullReferenceException at ExtractPassword

    Still working on getting a TeamCity build working (see my last post).  Latest exception is: C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets(120, 5): error MSB4018: The "SqlDeployTask" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Data.Schema.Common.ConnectionStringPersistence.ExtractPassword(String partialConnection, String dbProvider) at Microsoft.Data.Schema.Common.ConnectionStringPersistence.RetrieveFullConnection(String partialConnection, String provider, Boolean presentUI, String password) at … more

  • Could Not Load Type Microsoft.Build.Framework.BuildEventContext

    Setting up a TeamCity build and got this error: C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets(80, 5): error MSB4018: The "SqlSetupDeployTask" task failed unexpectedly. System.TypeLoadException: Could not load type 'Microsoft.Build.Framework.BuildEventContext' from assembly 'Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. at Microsoft.Build.BuildEngine.TaskExecutionModule.SetBatchRequestSize() at Microsoft.Build.BuildEngine.TaskExecutionModule..ctor(EngineCallback engineCallback, TaskExecutionModuleMode moduleMode, Boolean profileExecution) at … more

  • Fix: Can’t Change or Remove Visual Studio 2008 from DVD

    If you installed Visual Studio 2008 on a 64-bit operating system, you may have trouble when you try ad add or remove functionality by inserting the disk (or remounting the ISO image).  I believe this is because of the path used to install the 32-bit Visual Studio program.  When you run the setup.exe off of the disk, you get this: Clicking on Change or Remove Visual Studio 2008 brings up this dialog: But not long after it appears, it disappears to be replaced with: Microsoft Visual Studio 2008 Setup A problem has been encountered while loading the setup components.  Canceling setup. FIX: Use Add or Remove Programs Launch the Add or Remove Programs dialog in … more

  • Open Visual Studio Files As Administrator

    Working with IIS as your web server, or working with Azure projects, are two examples of situations in which Visual Studio (2008+) needs to be running as Administrator (on Windows Vista or Windows 7).  If you don’t run it as such, you may be faced with a dialog like this one (for Azure): Now of course if you have Visual Studio pinned to your taskbar or start menu, you can launch it as admin by right-clicking and selecting Run As Administrator, as Jeff Blankenburg shows here.  That’s great for one-off things, but in my scenario I really want to be able to double-click on a .sln file and have it open with Visual Studio as an administrator: The solution as suggested by … more

  • Eliminate Repetition with Action<T>

    Yesterday I was looking at some old code and refactoring it to clean it up (in this case I wasn’t the original author, but I’ve written code just like this).  The application in question was a simple process that had to run once per month, on demand, and so was coded up as an EXE application.  As it ran, it provided updates on its progress, so it looked something like this: static void Main(string[] args) { Console.WriteLine("Starting Application @ " + DateTime.Now); var parser = new ParameterParser(); Parameters parameters = parser.Parse(args); Console.WriteLine("Finalizing Revenue for " + … more