Posts

Error TF400324 when starting the Visual Studio Test Controller

I recently had a problem starting the Test Controller Configuration Tool. There was no error, but it simply hung on the loading state. A quick look at the event log showed three errors. The most important one was: The Controller service could not be started. TF400324: Team Foundation services are not available from server: [redacted URL] The URL was referring to an old team project collection. I actually wanted to use the Configuration Tool to change this URL. Since I could not attach the controller to another collection by using the Configuration Tool, I started to look around to find where the configuration itself was stored. The answer is an XML file named QTControllerConfig.xml located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE. I opened the file, replaced the content with this: <? xml version = " 1.0 " encoding = " UTF-8 " ?> < ControllerConfiguration xmlns = " http : // microsoft.com /schemas/VisualStudio/TeamTe...

Visual Studio TFS 2012 and Web Deployment Packages

Image
If you have been using Visual Studio 2010 and TFS to build Web Deployment packages (usable with MS Deploy), there is in the project properties a parameter for the name of the Web application in IIS. The parameter is available in the Package/Publish Web section under IIS Web site/application name to use on the destination server . Unfortunately this parameter is not available in Visual Studio 2012. You can specify it when using the Publish feature (by right-clicking on the project) but if you want to set up builds in TFS, you will end up with an application in IIS with a _deploy suffix. One possible solution is to add an additional parameter to the MSBuild command to update the IIS Web Application name. In the process properties of the build definition, update the DeployIisAppPath in the MSBuild arguments: MSBuild additional arguments

Entity Framework and TFS Build

I recently had an issue when trying to configure automatic deployments in TFS. I was building a MS Deploy package with one build definition and deploying it with another. The application was based on ASP.NET MVC with Entity Framework as a ORM When I tried to open the application on the target server, I got an error "Unable to load the specified metadata resource". The entity data model was configured to store the model files as resources into the assembly. The error was caused by the fact that the build process was no longer executing the packaging step. Usually Visual Studio does it automatically for you but MSBuild is not so kind. You have to manually tell it to execute the EntityDeploy step. I added an instruction in the project file (containing the data model) to execute the packaging step. < Target Name = " AfterBuild " > < EntityDeploy Sources = " Models\DataModel.edmx " outputPath = " . " > </ EntityDeploy ...

.NET 4.0 version of InformationBox

At long last, a .NET 4.0 version of InformationBox was published on CodePlex! As you might expect, it now supports the optional and named parameters making it a little easier to read the code. You can grab the latest source code release from here: http://infobox.codeplex.com/SourceControl/list/changesets

DateTimePicker and DateTime.MaxValue

For some unknown reason, the Winforms DateTimePicker control does not allow for dates higher than 9998-12-31. Trying to set the DateTimePicker MaxDate property of DateTime.MaxValue will result in an exception. This is a limitation imposed by the component itself. Good news is there is a small trick to overcome this limitation. It requires to update the static MaxDateTime property to an arbitrary value (DateTime.MaxValue in our case). Lets put up some reflection code for that purpose: var  dtpType =  typeof ( DateTimePicker ); var  field = dtpType.GetField( "MaxDateTime" ,  BindingFlags .Public |  BindingFlags .Static); if  (field !=  null ) {     field.SetValue( new   DateTimePicker (),  DateTime .MaxValue); } Just copy and paste this code into the startup method. Basically it needs to run before any DateTimePicker control is created. Please note that running this code can have side eff...

Create UserControl with inline content

Let's say you want to create a user control that contains some literal text: < uc1:InlineContent > This is some standard text message </ uc1:InlineContent > Here is the simplest UserControl that matches this description: using System.Web.UI; [ParseChildren(ChildrenAsProperties = true , DefaultProperty = " Content " )] public partial class InlineContent : System.Web.UI.UserControl { [PersistenceMode( PersistenceMode.EncodedInnerDefaultProperty)] public string Content { get; set; } }

Adding a delay before processing Textbox events

Typical scenario: You provide the user with a TextBox he can use to type a filter over a big chunk of data that takes a lot of time to process. Most of the time, you would handle the TextChanged event of the TextBox and issue a filter operation over the data source using the character(s) available in the TextBox. Typical problem: The user complains because he has to wait between the key strokes even if he already knows a filter that would allow the search to take place in a matter of a few seconds. Solution: Introduce a delay between the last key stroke and the processing using a timer. Walkthough: Create a new Winforms project with a Form. Add a TextBox (named textBox), a ListBox (named listBox). To mimic a very slow data source, we will create a dummy class: public class VerySlowDataAccess { private static string [] data = null ; static VerySlowDataAccess () { data = new [] { "AAAAAA1" , "AAAAAA2...