Moving to Wordpress

I've decided to move this blog to Wordpress.

I've appreciated Dotnetjunkies being my home for three years, but I feel it is not being maintained or updated. The community has also markedly slowed down a lot.

I've noted a lot of developers have started blogs on Wordpress, and I feel it is a pleasure to use, rather than fighting the Dotnetjunkies user interface. (To this day, I have no idea why comments will not work properly)

http://andrewwhitten.wordpress.com

I hope to have a higher profile with my new technology - Team Foundation Server - and I hope to see you there if you have an interest too :)

Visual Studio for Database Professionals can not use variables in build

I was happy to find that Visual Studio for DB Professionals (SP1) allowed you to add variables for your database scripts on a configuration level.

Great! I thought I could generate SQL scripts for my entire database depending on it being a production or test target. How useful!

Well.. not really...

As try as I might, I could not get those variables to appear in my SQL script.

I got an answer from the forums to say that basically this can ONLY be done when 'deploying' a database.. building one is apparently not reason enough for DB Pro to replace variables.

They said that the SQLCMD command might want to override variables, which is why they don't replace them during build.

I admit.. the 'deploy' functionality of DB Pro is great.. it is smooth and simple.

BUT I can not (nor would I ever) use it to deploy to a production database. For this task, I would generate a SQL script (via build) and give it to the production support team. I would never come close to touching that database.

So... basically this great feature is rendered useless...

I had to instruct my SQL script to examine the database name for environment variables

IF DB_NAME() == 'MyProductionDatabase'
BEGIN
INSERT ....
END

Run TFS Team Build with project from Team Edition for Database Professionals

I like Team Edition for Database Professionals... if you do ANY management of Sql Server databases then you should take a look and ask yourself if your life wouldn't be easier to use it.

I then thought "Wouldn't it be cool to build these database projects on TFS?"

Yeah.. it would, but it isn't as simple as it should be.

First problem: You need to install 'Team Edition for Database Professionals' on your Build machine.. messy, but not a show stopper.

Second Problem: Permissions.

If you have a good TFS Build Server, then your user should be a Windows Standard User.. and not a super God like user that you need to run anything without pain on a Windows machine.

1) First, identify your build user, for example: Hal-Domain\Dave

2) In the Sql Server 2005 management tool, assign Hal-Domain\Dave as dbcreator and securityadmin

3) Run the following sql as DBO:

USE MASTER

GO

GRANT EXECUTE ON sp_detach_db TO public

GO

GRANT VIEW SERVER STATE TO "Hal-Domain\Dave"
GO

A full overview of permissions can be found here

For search engines, the error was:

Microsoft.VisualStudio.TeamSystem.Data.Common.Exceptions.DesignDatabaseFailedException: You have insufficient permissions to create the database project.

Force refresh of TFS file status

It seems the hardest part of being a Team Foundation Server admin is the 'This is how things worked in Visual SourceSafe' way of thinking.

Well, today I came across a legitimate gripe.. the status icons of a file do not always update properly, even when you do a 'get latest'.

I found a way around it, but frankly this should be default behavior:

http://devmatter.blogspot.com/2007/07/refreshing-tfs-version-control-status.html

Hiding certain Team Builds for certain users

The good thing about MSDN Forums is that you get questions you may not otherwise ever think about, and by so doing you increase your knowledge about the subject.

One poster wanted to know how to 'hide' particular team builds from particular users, but allow them to execute other builds in the same Team Project in Team Foundation Server.

My initial feeling was that this wasn't possible, but a little experimenting proved me wrong:

If you have a Team Build called 'SecureBuild' you want to deny to the group [SERVER]\NormalDevs, do the following:

In 'Source Control Explorer', find your build project under .\TeamBuildTypes\SecureBuild\SecureBuild.proj

Right mouse click on MyBuild.proj and select 'properties...'

In the resultant dialog, click on the 'security' tab.

In the listed groups, choose the [SERVER]\NormalDevs group who you do not want to be able to build.

Simply set their 'Read' permission to 'Deny'

When they look in their 'Team Builds' in 'Team Explorer', 'SecureBuild' will no longer appear.

Adding an SMTP alerts server to TFS

I didn't have the information about the email server before setting up TFS, but figured it would be easy to set up afterwards.... wrong :)

Well, actually it *is* easy, but just isn't straightforward to find.

Find your TFS service web.config file.. on my machine it is here:

C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\web.config

and add/adjust the following xml tags:

<appSettings>
<add key="ConnectionString" value="Application Name=TeamFoundation;Persist Security Info=False;Initial Catalog=TfsIntegration;Data Source=xxxxx;Integrated Security=SSPI"/>
<add key="eventingEnabled" value="true" />
<add key="DetailedExceptions" value="false" />
<add key="emailNotificationFromAddress" value="andrew@xxxxxxxxxxxxx.com" />
<add key="smtpServer" value="smtp.mailserver.xxxxxxxxxxxxx.com" />
<add key="SmtpUserName" value="MyDomain\MyUser" />
<add key="SmtpPassword" value="MySecurePassword" />
</appSettings>

TFS Web Access Power Tool

Take a look at the official release of the TFS Web Access tool (formally 'TeamPlain')

What's to say? It give you access to the TFS server via your web browser rather than Visual Studio. I like the way it resolves our Active directory id's into our real names in the changeset reports.

Installation was extreemly easy, simply installing itself as a new website on your TFS server.

And it just feels good to start a build and watch its progress via your web browser.

I can now use my underpowered laptop next to my development desktop to monitor and control TFS. Pretty good.

MSI Build Error with TFS Build Server and WiX

I found that my WiX 3.0 project was not building on my Team Foundation Server build machine.

For the benefit of search engines, the exact line was:

"light.exe(0,0): error LGHT0216: An unexpected Win32 exception with error code 0x659 occurred: This installation is forbidden by system policy. Contact your system administrator"

At first I thought that WiX was attempting to install on the server.. but after some digging I found out that it was just trying to run a verification of the MSI file.

Under my Windows 2003 machine the builder was a standard user with no permission to do this.

Therefore the resolution was to go into the properties of the WiX Project in Visual Studio, and click the 'Advanced...' button in the 'Linker' tab.

(By the way, you may need to resize your screen a bit for this button to refresh and show up)

In the resultant window, select the 'Supress MSI/MSM validation' under the 'Suppresions' tab.

Everything should work fine now :) I guess the next question would be.. what to do when you need a validation of your MSI? I guess this is a good case for running build as an administrator under an XP box.

Update TFS Reports

I made some changes to my Team Foundation Server builds, and wanted to check out the nice new reports.. only to see they havn't been updated yet.

Kevin Castle has a good overview of this, explaining that the data warehouse does not update itself right away. There is a web service he suggests that you call, although the manual web address for me is different (SP1 maybe?)

http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx?op=Run

Connect to Team Foundation Server with an IP Address

I have a virtual machine image of TFS in workgroup mode that I want to try out some project settings on before promoting to the production TFS server I have on the domain.

However, it seems that attaching Visual Studio Team Explorer to this machine is not possible by directly connecting to its IP Address.

What you can do is modify your hosts file in C:\WINDOWS\system32\drivers\etc (under Windows XP) and associate a name with the IP Address.

You should now find you can connect using this name.

Imagine Cup at Remix

I took a look at the work of the Canberra University team at ReMix today.
This is for Microsoft's Imagine Cup competition, and I really wish I could have done this when I was at university!
They gave a presentation about Audio Studio .NET, which is a system designed to help blind people become productive with programing tools. Definately some interesting user interface challenges around things such as intellisense and documentation, which is implemented though a speech API.
Each year they are aiming to raise the profile of this competition, hence encouraging the blogging of this event. :)

Overview of WCF security

Really good overview: http://www.theserverside.net/tt/articles/showarticle.tss?id=WCFSecurityLearningGuide&asrc=EM_NLN_1469314&uid=2453545

Sql Server 2005 Reporting Services Tutorial

Reporting services is a great feature of SQL Server, but it is not obvious how to do everything it can do if you're pushed for time.

Steve Joubert pretty much covers it all in four great short tutorials, I've bookmarked these for good!:

Part 1
Part 2
Part 3
Part 4

Ethical vista laptops?

There has been a great deal of interest on Dotnetjunkies about the Edelman 'free Vista laptops' issue.

My take is that if it is unethical to accept a laptop, is it also unethical to accept swag at a conference? The principle being that free stuff == warm fuzzy feelings?

At the moment, Vista is known only to Microsoft developers and Linux fanboys. It isn't actually a bad thing that Microsoft is trying to let people know about it. One hopes they can think of a better strategy than “Free laptops for those cool trendy blog people!” :)

Restart XP from command line

When logging in by Remote Client, it isn't obvious how you can reboot the machine... just use this from the command prompt:

shutdown -r -t 60 -c "Rebooting computer"

Powershell

As a .NET developer, Windows Powershell is a great way to increase one's productivity. Whilst the old 'DOS Prompt' is useful for basic text based operations, the new Powershell allows you to work with objects, giving you a great deal of flexibility when dealing with (for example) a list of file objects brought back from an Active Directory query. To get into it, best download the free IDE, and check out some of the basic scripts available on TechNet.

Microsoft Windows Mobile 5.0 - Application Development

Microsoft have announced:  Exam 70-540: Microsoft Windows Mobile 5.0 - Application Development

This is really great news, since it shows that MS has commitment to the platform, and sees value in people becoming certified to develop for it.

This blog entry has details how you can sign up for the beta exam:

http://blogs.msdn.com/lokeuei/archive/2006/08/21/711117.aspx

Preparation guides are a bit light on the ground, but it looks managable for anyone who has worked in this area.

Atlas + Wizard control validation bug

When using the ASP.Net 2.0 Wizard control with validation under Atlas, then you have to ensure that there is a validation control on EVERY page of the wizard, or an unhelpful 'null object not found' script error appears.

If you do not need a validation control on a particular wizard step, 

  1. Add a text box with some text inside it to the step
  2. Add a RequiredFieldValidator to it.
  3. Hide the textbox control with a 'Visibility: hidden' CSS style tag. (Using the 'Visibile' property of the control will not work)

(I am using source code release 137. Future releases may have fixed this bug)

Atlas flicker problems

I have a demo next week, and the dynamic collapsible panels from the Atlas Control Toolkit were flickering like crazy. (Especially my listboxes)

So.. I found this discussion thread and installed IE 7 (Beta 2) to see if it made a difference, and it became as smooth as a standard desktop app.

Firefox (Version 1.5.0.4) is also quite good for this

 

 

Integrate RSS with Outlook 2007

Although not comprehensive, there is a nice RSS reader integrated in Outlook 2007, and you can enable your users to add feeds to it by simply publishing the link to your rss feed as a link with 'outlookfeed' instead of 'http' like this:

outlookfeed://dotnetjunkies.com/WebLog/andrewwhitten/rss.aspx

It doesn't support many of the tags, but here are the basics:

  • <Title>               - Name of the post
  • <Description>    - The main body of the post, can be HTML
  • <Author>           - Who wrote this
  • <PubDate>        - When post was published