Steve Smith's Blog

Musings on Software and the Developer Community

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...

Fix: SqlDeploy Task Fails with NullReferenceException at ExtractPassword →

Posted on Wednesday, 10 March 2010         1 Comment

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...

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

Posted on Wednesday, 10 March 2010         2 Comments

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...

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

Posted on Monday, 08 March 2010         1 Comment

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...

Open Visual Studio Files As Administrator →

Posted on Wednesday, 03 March 2010         1 Comment

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...

Eliminate Repetition with Action<T> →

Posted on Tuesday, 02 March 2010         2 Comments

SQLite Error IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found.

I just ran into a problem with SQLite and NHibernate, which was giving me this error message: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. The strange thing was, it worked fine from within Visual Studio, but it died when I used my ClickToBuild.bat file, which calls msbuild and runs my tests from the command line.  A bit of searching led me to a similar problem on StackOverflow , which produced the answer: Use the x64 binaries. I downloaded...

SQLite Error IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. →

Posted on Friday, 26 February 2010         No Comments

Untrusted Projects and Blocked Files in Visual Studio

I was just trying to open a project I was emailed as a zip file from a colleague.  VS2010 opens up saying: You should only open projects from a trustworthy source. The project file 'project' may have come from a location that isn’t fully trusted. It could represent a security risk by executing customer build steps when opened in Microsoft Visual Studio that could cause damage to your computer or compromise your private information. Which is fine… but in this case I know the project is OK so...

Untrusted Projects and Blocked Files in Visual Studio →

Posted on Thursday, 25 February 2010         1 Comment

SELECT from a Stored Procedure

Occasionally I find myself wanting to SELECT from a SPROC in SQL Server.  Usually this is because I want to ORDER the results or filter them further with a WHERE clause.  Unfortunately, you can’t just do this: SELECT * FROM ( EXEC mySproc foo, bar) There are several workarounds here, and the appropriate one depends mostly on whether you have any control over the use of the stored procedure, or how it works.  For example, you could choose to use a VIEW instead of a stored procedure...

SELECT from a Stored Procedure →

Posted on Wednesday, 24 February 2010         4 Comments

Avoid Regions for Interfaces in Visual Studio

Another quick tip related to the use of regions in your C# code – you can turn off the default behavior of wrapping interfaced implementations in regions via the options dialog.  Simply go to Tools –> Options –> Text Editor –> C# –> Advanced as shown in the screenshot below, and uncheck the “Surround generated code with #region” checkbox....

Avoid Regions for Interfaces in Visual Studio →

Posted on Monday, 22 February 2010         3 Comments

Moving SVN Repositories to new Server

Recently I had to move some SVN repositories from one server to another .  Here are the steps that worked for me, courtesy of Pete Freitag : Step 1: Back up SVN Repository Back up your existing repository with the following command.  Note that if you are using VisualSVN Server as I blogged about previously, you should be able to right-click within the VisualSVN server manager and get a command prompt that will have the correct paths and such to do this: svnadmin dump /path/repositoryfolder...

Moving SVN Repositories to new Server →

Posted on Monday, 15 February 2010         3 Comments