Skip to main content


Showing posts from November, 2010

Windows Azure SDK updated

Today the Azure team released SDK 1.3 and the updated tools for Visual Studio. Download the SDK here: New for version 1.3: Virtual Machine (VM) Role (Beta): Allows you to create a custom VHD image using Windows Server 2008 R2 and host it in the cloud. Remote Desktop Access: Enables connecting to individual service instances using a Remote Desktop client. Full IIS Support in a Web role: Enables hosting Windows Azure web roles in a IIS hosting environment. Elevated Privileges: Enables performing tasks with elevated privileges within a service instance. Virtual Network (CTP): Enables support for Windows Azure Connect, which provides IP-level connectivity between on-premises and Windows Azure resources. Diagnostics: Enhancements to Windows Azure Diagnostics enable collection of diagnostics data in more error conditions. Networking Enhancements: Enables rol

Lab management deployment script arguments

Lab management 2010 allows you to automate the build-deploy-test workflow. By following a simple wizard, you can easily create a build of your code, run some deployment scripts to deploy the build on a test environment and run some tests inside this environment and all this by just triggering a new build inside Visual Studio. The deployment scripts being run as part of the workflow can be anything from a batch file to an MSI or a power shell script. There are a few built-in arguments available that can be passed to these scripts:   Argument Description $(BuildLocation) Refers to the location from where the binaries will be picked up for deployment. It depends on the option that is chosen in the "Build" page in the "Lab Workflow parameters" wizard. If "TeamBuild" option is chosen, then the drop location of the concerned build will be referred to. If a build location is specified explicitly, then that loc

Change the placement policy of your System Center Virtual Machine Manager configuration

Last week a colleague was creating a new test environment using the Team Foundation Server Lab Management features when we encountered following error: Error when creating a new virtual machine on <machinename>: TF259115: Team Foundation Server could not find any suitable host to deploy the virtual machine: <machinename>. Contact your administrator to fix the issues on the hosts below. (Hosts are listed in brackets) Memory requirement of the virtual machine(s) exceeds the available host resources. The placement policy for this host group is set to be conservative and hence virtual machines that are in stopped state are also accounted as consuming host resources. Your administrator can change this policy by running the TfsLabConfig tool. As our lab management environment has a large set of virtual machines who are in a stopped state, we ran out fast of memory resources. We can change this behavior to exclude the non-running machines from memory usage. T

Slow connection when connecting to Team Foundation Server from Visual Studio 2010

At a client we were testing our newest line of development machines. After installing Visual Studio 2010 we noticed that the performance was VERY slow when connecting to Team Foundation Server (2010). Performing a get latest of a large solution took several hours(!). Some investigation showed that it does not appear to be a TFS issue per se but rather something lower in the .NET Framework stack, having to do with automatic proxy discovery through the WPAD protocol. You can work around the issue by turning off proxy autodiscovery on a per-application basis by using a .exe.config setting. The .exe.config for Visual Studio is %VSINSTALLDIR%\Common7\IDE\devenv.exe.config and it already contains a section in the .exe.config for System.Net. After adding the defaultProxy element, that section would look like this: 1: < > 2: < defaultProxy enabled ="false" /> 3: < settings > 4: < ipv6 enabled ="true" /> 5:

WPF and Winforms “airspace problem”: a solution

In a previous post , I talked about the “airspace problem”, an issue you can encounter when you are using WPF and WinForms in the same application. I created a small sample application that shows the issue and I’ve also added a possible solution. If you run the application, you’ll see the following user interface: This userinterface contains the following important elements: A WPF Grid control that is not visible by default A WPF button A WindowsFormsHost control containing a usercontrol with a calendar control inside When you click the button, the WPF Grid will be made visible. You see that the winformshost control is still shown on top of the grid(recognizable by the brown border on the left and the bottom. Now try again but first select the Solve Airspace problem checkbox. This time the control is correctly shown on top of the winformshost. Download the code and the sample application here .

Learn Python the hard way

They always say that to be a good programmer, you have to learn a new programming language every year.  I am still finding my way in the Ruby world, but for people who are looking for the next challenge, I can recommend “Learn Python The Hard way” , a free e-book for people who want to learn Python . It is really, really(!) basic but I found it useful to get the syntax in my fingers without having to think too much about more complex programming problems.

Build fails after upgrading to Visual Studio 2010

After upgrading our solution and projects to Visual Studio 2010, our builds started to fail with the following error: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1917,9): errorMSB3086: Task could not find "LC.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed For a reason I don’t know it expects the 7.0A SDK. And indeed on the build server this SDK was not installed. With that knowledge I copied the directory "Program Files\Microsoft SDKs\Windows\v7.0A" from my development machine to my build server. I then exported the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" registry key from my development machine and merged into the regist

Sharepoint Schema version error

At a client, the Team Foundation server 2010 environment was working fine until suddenly the Sharepoint stopped working. In the event log, I found the following error message: The schema version ( of the database SharePoint_AdminContent_d3718c5d-5516-41e1-ba7d-6e5a3c21ba75 on DatabaseServerX is not consistent with the expected database schema version ( on ApplicationServerY. Connections to this database from this server have been blocked to avoid data loss. Upgrade the web front end or the content database to ensure that these versions match. I found out that Windows Update had installed some patches which upgraded the Sharepoint application front end to a higher version. Unfortunately this made the front-end and the underlying database incompatible. I fixed the problem by executing the following commands on the application server: 1: stsadm -o upgrade -inplace -url < central admin url > 2:   3: iisreset

Team Foundation Server 2010 Extensibility

A lot of customers ask me which parts of Team Foundation Server and the Team Explorer Client are extensible. And my answer is always the same: everything! To give you some ideas and examples, go to the  TFS SDK page and download some of the available samples . One of the coolest examples is the “Extending Team Projects sample” , it extends Team Projects and Team Explorer in TFS 2010 and includes a Project Creation Wizard plug-in and a Team Explorer plug-in. Project Creation Wizard This sample uses a custom process template that declares a special group ID that includes a task list from a separate XML file. That XML file includes a set of web links arranged in a folder structure. Those links are passed to the Project Creation Wizard plug-in as the new Team Project is getting created. The plug-in also adds a new page to the wizard that lets the user enter additional web links and, optionally, to add a link to the newly created Team Project in Web Access. This page derives from

Windows Workflow Foundation 4: State Machines

With the release of .NET Framework 4, Microsoft completely rewrote the Windows Workflow Foundation(WF) implementation. One of the consequences was that the original workflow types(state machine and sequential) were replaced by a new sequential and flowchart implementation leaving state machines out of the picture. With the Microsoft WF State Machine Activity Pack CTP 1 Microsoft reintroduces a state machine implementation based on Windows Workflow Foundation in .NET Framework 4 (WF 4). The implementation contains not only a state machine runtime but also a graphical state machine designer. It’s a really great and robust CTP for everyone who needs state machine workflows. Thank you, Microsoft.

Windows Azure Connect

A few weeks ago, I blogged about Project Sydney . In the meantime Microsoft has released a first CTP under it’s official name: Windows Azure Connect . “Windows Azure Connect provides a simple and easy-to-manage mechanism to setup IP-based network connectivity between on-premises and Windows Azure resources. This capability makes it easier for an organization to migrate their existing applications to the cloud by enabling direct IP-based network connectivity with their existing on-premises infrastructure. For example, a company can deploy a Windows Azure application that connects to an on-premises SQL Server database, or domain-join Windows Azure services to their Active Directory deployment. In addition, Windows Azure Connect makes it simple for developers to setup direct connectivity to their cloud-hosted virtual machines, enabling remote administration and troubleshooting using the same tools that they use for on-premises applications.” You can register for the CTP here . If you

View builds across multiple projects

One very annoying thing in Team Foundation Server 2010 is that you can only see the builds for 1 team project in Team Explorer. This is especially a problem when you are running many builds and you want to know which builds are already queued/running. Luckily this is really easy to create yourself using the TFS object model.  Create a simple console application in Visual Studio and add the following code:   1: using Microsoft.TeamFoundation.Client; 2: using Microsoft.TeamFoundation.Build.Client; 3:   4: var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection( new Uri( "http://myTFS/MyCollection" )); 5: var bs = tfs.GetService<IBuildServer>(); 6: var qbSpec = bs.CreateBuildQueueSpec( "*" , "*" ); 7: var qbResults = bs.QueryQueuedBuilds(qbSpec); 8:   9: foreach (var qb in qbResults.QueuedBuilds) 10: { 11: var status = qb.Status.ToString(); 12: var def = qb.TeamProject + @"\"

Logging Visual Studio Actions

As almost every piece of software Visual Studio behaves strangely from time to time, weird error messages, crashes,… I’ve seen it all. A first help to trace the source of the problem is to start Visual Studio with logging enabled. You can do this by starting Visual Studio with the /log switch: devenv.exe /log [filename] The [filename] is optional and if not specified will call the log ActivityLog.xml by default.  The path is to the file is: %APPDATA%\Microsoft\VisualStudio\<version>\ActivityLog.xml  There is an XML stylesheet (XSL) comes with the XML data so if you view the file in your browser you will see this nice view:

From developer to designer: Kuler

Most developers are really great at writing code but if you ask them to create a user interface, they always come up with the same boring standard WinForms/WPF user interface. We all seem to suffer from a lack of aesthetic skills. To help you improve the look and feel of your windows/web application, I have one really nice tool to add to your toolbox: Kuler .  “Kuler is a web application for generating color themes that can inspire any project. No matter what you're creating, with Kuler you can experiment quickly with color variations and browse thousands of themes from the Kuler community” One of the features I really like is the ability to create a style theme from an image. If there is a specific painting, photo, … you like, it can be used a starting point for your own color theme. Try it yourself…

HTTP 403 when opening Sharepoint page

When I tried to open the Sharepoint portal for a Team Foundation server 2010 Team project, I received the following 403 error:   I had all the necessary rights and was connected to our domain, so I didn’t understand why this message was shown. It took me some time to find out that someone had changed the IIS server settings and changed the use of HTTPS and SSL to Required . Therefore I got an error when I connected to the website over HTTP. A more meaningful error message would have saved me a lot of time…

Could not open a Silverlight project

When I tried to open a Silverlight project inside Visual Studio 2010, it failed with the following error message: “The imported project "C:\Program Files\MSBuild\Microsoft\Expression\Blend\3.0\Silverlight\Microsoft.Expression.Blend.Silverlight.targets" was not found.” When I tried to open the project on another machine it worked fine. So I realized that it had to be an installation issue. After comparing the two systems I noticed that the Blend 4.0 SDK wasn’t installed on one machine. After installing the SDK everything worked perfect.

Enterprise Library 5 Fluent Configuration

One of the big disadvantages of Enterprise Library was that the configuration was very XML centric. In Enterprise Library 5 a new fluent configuration API has been added which allows you to configure your Enterprise Library settings without writing ton’s of XML. The API makes configuring Enterprise Library very intuitive and easy to learn. In order to use the fluent configuration API , you need to create a ConfigurationSourceBuilder which is the main class to build a runtime configuration. Each feature in Enterprise Library , such as the application blocks for example, provides extension methods for this class which enables us to use the API in the same manner. Thanks to the use of extension methods this is very intuitive and easy. The ConfigurationSourceBuilder class is located in the Microsoft.Practices.EnterpriseLibrary.Common.Configuration DLL and you need to reference it. In order to use the fluent configuration extension methods for every application block , you need to add

The [TestCategory] attribute

One of the lesser-known features added to .NET 4.0 is the TestCategory attribute . Comparable to the Category attribute in NUnit –this allows you to group your tests in functional categories. Using test categories is now the preferred way of running groups of tests, and you no longer need to deal with tests lists (.vsmdi files), which are tedious to maintain and very difficult to merge. You can use these test categories to optimize the build experience when using Team Build 2010. In the Build Definition there is a new option that allows you to include, exclude, combine,… multiple test categories in a build. Read more about it on MSDN .

Daddy, when I grow up I want to be a small basic developer

15 years ago I wrote my first program in Turbo Pascal . Nowadays if you have children and want them to learn programming check out Microsoft Small Basic , which combines a simple (but powerful!) language and a rich set of libraries together with a friendly development environment. The Small Basic language draws its inspiration for an early version of BASIC but it is actually based on the .NET Framework. Like the early variants of BASIC it is based on, Small Basic is imperative and doesn't use or expose beginners to concepts like scopes, types, object orientation, etc. Even though it is based on the .NET Framework, it really is small and consists of just 14 keywords. In fact, there really isn’t a type system. You can create string and numeric constants and assign them to variables. Operations performed on these variables will be interpreted according to the content. All variables are global and are always initialized, so they can be used before they're assigned. It’s ve

Don’t install Async CTP and ASP.NET MVC 3 RC on the same PC

After returning from TechEd Berlin this Friday, I downloaded and install the recent release of the ASP.NET MVC 3 RC build .  Everything seemed fine, until I tried to debug something inside Visual Studio. I couldn’t do any kind of useful debugging. I found out on Scott Guthrie’s blog that it’s a known issue caused by installing both ASP.NET MVC 3 RC and C#/VB Async CTP. At this moment it isn’t possible to have both the Async CTP and the ASP.NET MVC 3 RC installed on the same machine at the same time.  You instead need to choose one or the other right now – installing both will cause problems. To fix this, go to Add/Remove Programs and uninstall both the ASP.NET MVC 3 RC build (including the VS Tools components for it) and the Async CTP. Once you’ve uninstalled both your machine will be back to a clean state and working fine.  You can then choose to install either the Async CTP or ASP.NET MVC 3 RC and it will work fine. Async CTP Uninstall Instructions The Microsoft Visual Stu

Windows Azure Platform Introductory Special Extended

If you are planning to start with Windows Azure, I have some good news for you. The Windows Azure Platform Introductory Special offer (which includes the SQL Azure Free Trial ) has been extended through March 31, 2011! This promotional offer enables you to try a limited amount of the Windows Azure platform at no charge. This subscription includes each month : Windows Azure 25 hours of a small compute instance 500 MB of storage 10,000 storage transactions Windows Azure AppFabric 100,000 Access Control transactions 2 Service Bus connections SQL Azure 1GB Web Edition database (available for first 3 months only) Data Transfers (per region) 500 MB in 500 MB out You still need to provide your credit card because you are still charged when your usage exceeds these amounts.

IBM announced the beta release of its driver for Visual Studio 2010

After a really long waiting period, it’s finally there, a beta version of IBM’s .NET provider for .NET Framework 4.0 as well as Addins for Visual Studio 2010. This beta level package requires a V9.7 FP3a client install(available here: ) , and has the following features: DB2 .NET provider for connectivity to DB2 LUW, IDS, DB2 for z/OS and DB2 for IBM i DB2 Connect license required for z/OS and IBM i Common IDS .NET provider for IDS Entity Framework provider Entity Framework support for database first scenarios Entity Framework canonical function support Full filtering of Add Connection properties when use with Entity Framework Designer Visual Studio 2010 Addins Full Server Explorer filtering support Windows, Web and WPF application development scenarios with full drag and drop Designer support for SQL Procedures with syntax highlighting Full end to end debugging for SQL procedures

Entity Framework vs NHibernate

A lot of stuff has been written about Entity Framework versus NHibernate. Although with the release of Entity Framework 4, the gap became a lot smaller, NHibernate 3 brings the competition to the next level (at least that is what I think). Dino Esposito did a blog series where he tries to compare Entity Framework(4) and NHibernate(2.1)  on multiple areas. I don’t agree with his conclusions on all levels, but it’s still an interesting read: Part 1 A comparison on multiple database support in the Entity Framework and NHibernate O/RMs. Part 2 Looking into some programming features such as lazy loading. Part3 Fetch plans-a recognized and common way for developers to instruct the O/RM about the structure of the SQL you desire.

Team Foundation Server get’s cloudy

At Microsoft PDC 2010 Brian Harry showed a first preview of TFS 2010 installed and hosted on the cloud.  Hosting of ALM in the cloud is a great example of software as a service.  This making it really easy to get started with Team Foundation Server. Note that this is not a final product and no details were revealed about release date and pricing. Read more at Brian Harry’s blog:

WPF vNext: Microsoft will solve the ‘Airspace problem’

If you ever tried to combine multiple UI technologies like WPF and WinForms, you sooner or later are confronted with the ‘Airspace problem’. “Airspace" is a conceptual way of thinking about how the two halves of an interoperation application share the rendering areas within a common top-level window. This article explains how the "airspace" concept might influence the presentation design as well as the input considerations for your WPF interoperation application. Practically speaking, this means that WinForms content hosted in a WindowsFormsHost always appears on top of WPF content. So if you are using WPF adorners they will appear to be "trimmed" if they hit up against a WinForms region in your app. There are some tricks to tackle this issue, but none of them are really clean. On the screenshot below you see that the calendar control on the left hosted in a WindowsFormsHost is not overlayed by the red bar although it has the highest z-index defined in X

Silverlight UI testing is coming to Visual Studio

At DevConnections , Microsoft announced that Visual Studio 2010 Feature Pack 2 will be available in the next couple of weeks.  Feature Pack 2 will contain enhanced testing support for Silverlight and Firefox applications along with a UI editor for coded UI tests . Microsoft Visual Studio 2010 Feature Pack 2 enables the following scenarios: Silverlight 4 support: Capture and playback of Action Recordings for Silverlight 4 Applications. Automated coded UI tests to be written and executed against Silverlight 4 applications Ongoing edits to coded UI test projects using a graphical editor.   Firefox Support: Fast Forward of action recordings from Microsoft Test Manager for Mozilla Firefox 3.5+ Automated testing from Microsoft Visual Studio 2010 for Mozilla Firefox 3.5+ (playback only).   Feature Pack 2 is a cumulative feature pack where Visual Studio 2010 Feature Pack 1 (“Visual Studio 2010 Visualization and Modeling Feature Pack

Programmatically invoke an event handler for a control

To test the behavior of a custom Windows Forms button control I had created, I had to trigger the Click event handler from code. There are multiple ways to achieve this, but I choose to combine a helper class with some convention based reflection. I created a static class UIHelper with the following method: 1: public static void TriggerEvent(Object targetObject, string eventName, EventArgs e) 2: { 3: String methodName = "On" + eventName; 4: 5: MethodInfo mi = targetObject.GetType().GetMethod( 6: methodName, 7: BindingFlags.Instance | BindingFlags.NonPublic); 8: 9: if (mi == null ) 10: throw new ArgumentException( "Cannot find event named " +methodName); 11: 12: mi.Invoke(targetObject, new object [] { e }); 13: } In this code I took advantage of the fact that by convention event handlers are internally called by a protected method called On[EventName]. An example:   a C

An impressive Azure story: Pixar’s Renderman

Last week at the PDC2010 keynote , Pixar Animation Studio’s Chris Ford demoed a cloud-hosted prototype of their Academy Award-winning Renderman solution . I wasn’t very impressed with the “cloud” demos I have seen before, but this one blew me away. The application they showed allows anyone from small studios to even indie filmmakers to take advantage of the powers of Renderman, even if they don’t have the resources to establish and support a rendering farm. What the demo made really impressive was a simple slider where you could balance (in realtime) how much you were willing to pay against how long the rendering job would take. This flexibility to scale (both up and down) is one of the greatest benefits of cloud computing.   (Pictures from Long Zheng )

Clean up your Visual Studio bin folder by using Powershell

Every once in a while,  my hard disks got filled up.Today it happened again. I knew that a lot of disk space was eaten up by compiled code living inside the bin folder of all my projects. After a rough estimate I ended up with 12 GB of compiled code! I could have started by opening up every project folder and manually delete every bin folder. Luckily Powershell just made that job a whole lot easier. Here’s the command to remove all obj & bin folders from a path (assuming you’re in the path now): 1: Get-ChildItem .\ -include bin -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } If you’re not in the correct folder just replace .\ with the full or relative path. You’ll still need to close down Visual Studio first, the -Force switch will override permission failures, but not process locks. Note: this does a forced delete without prompting for confirmation, so you’d better be really sure you want it all gone. If you don’t want to take any risk first add  -Wha

Lab Management questions… and answers

Microsoft Visual Studio 2010 Lab Management is not one of Microsoft’s most easy products. You need a lot of different components installed, there is tons of configuration and you’ll have to find your way through multiple products, user interfaces and command line tools. Luckily I found this post by Richard Fennell where he tries to tackle some common questions.

SynchronizationContext, a multithreaded UI best friend

Of course we are all waiting for the new async features in C# 5 as announced by Anders Hejlsberg at PDC 2010.(Download the Visual Studio Async CTP ), implementing a set of changes to the C# language that support a new pattern for asynchronous programming. In the meanwhile we still have to do it the old fashion way by executing work on background threads and marshalling the results back to the main UI thread. One very important player in this story are the different implementations of the SynchronizationContext class. Depending on the kind of application, different implementations are used. Windows Forms: System.Windows.Forms.WindowsFormsSynchronizationContext , used by the GUI thread(s) in Windows Forms applications. Other threads in the same application may use different SynchronizationContext implementations. Windows Presentation Foundation and Silverlight: System.Windows.Threading.DispatcherSynchronizationContext , used by the GUI thread(s) in Windows Presentation Founda

Windows Azure ‘Extra Small’ Compute Instance

At PDC 2010 Bob Muglia announced a new “extra small” compute instance, priced at 5 cents/hour. This Extra Small Windows Azure instance seems especially useful for developers to test their application at an affordable cost. This brings the total number of Windows Azure compute instances flavors to five:   Compute Instance Size CPU Memory Instance Storage I/O Performance Cost per hour Extra Small 1.0 GHz 768 MB 20 GB Low $0.05 Small 1.6 GHz 1.75 GB 225 GB Moderate $0.12 Medium 2 x 1.6 GHz 3.5 GB 490 GB High $0.24 Large 4 x 1.6 GHz 7 GB 1,000 GB High $0.48

Team Explorer Everywhere 2010 SP1 Beta available

If you are a non-.NET developer and you are using Team Explorer Everywhere today or you are still hesitating to start using it, don’t wait any longer. With the upcoming release of Team Explorer Everywhere SP1, a long list of new features and improvements are added. If you can not wait, just go the following link and download the latest bits: . If you first want to learn about these new features, continue reading. Gated Check-in Support With SP1 Eclipse developers finally get the full experience of gated check-ins. When you check-in code affected by a gated build definition you get a prompt as to what you would like to do. Assuming you request a gated build, the changes will be shelved and a build submitted on your behalf.  When the build completes you will be notified right inside of Eclipse. Private / Buddy Builds Another new feature in the build space is the