Skip to main content

Posts

Showing posts from 2008

Recursive Copy in TFS MSBuild

In working with TFS I just discovered the Well-Known Item Metadata (bad name in my opinion as I don't they they are really all that "Well-known") which can be used in MSBuild. One of these is %(RecursiveDir) . From MSDN:If the Include attribute contains the wildcard **, this metadata specifies the path to the file, beginning at the location of the wildcard. For more information on wildcards, see How to: Use Wildcards to Build All Files in a Directory. This example has no RecursiveDir metadata, but if the following example was used to include this item, the item would contain a RecursiveDir value of MyProject\Source\. <ItemGroup><MyItemInclude="C:\**\Program.cs"/></ItemGroup>If the following example was used to include this item, the RecursiveDir value of the item would remain MyProject\Source\. <ItemGroup><MyItemInclude="C:\**\Source\Program.cs"/></ItemGroup> This gives a lot of flexibility when using MSBuild. It all…

Custom TFS Task to Change WorkItem State

I recently had to create a custom task to update the state all work items associated with a changeset were in. Here is the code I came up with to accomplish this. First we start of by creating a general class that includes a few properties. The properties will allow us to pass in variables to the task. LocalPath and BuildURI are variables which TFS build provides for you. I also included the using statements you need to have for this task. 1:using Microsoft.Build.Utilities; 2:using Microsoft.TeamFoundation.Client; 3:using Microsoft.TeamFoundation.VersionControl.Client; 4:using Microsoft.TeamFoundation.WorkItemTracking.Client; 5:using Microsoft.TeamFoundation.Build.Client; 6: 7: 8:namespace MyCustomStuff.TFS.Tasks 9: { 10:publicclass UpdateWorkItemStatus : Task 11: { 12:// A value for each one of these properties must be supplied in the XML build file. 13:// LocalPath and BUILDURI can use the MSBuild variables of $(TeamFoundationServerURL) and $(BuildURI) 1…

Silverlight Webcasts

Copy Multiple Files via TFS build

bI have recently been doing a lot of work with TFS and want to write about a few things I had to figure out how to do. As part of my build process I had a number of dlls I needed to copy out to my staging environment. To do this I overrode the AfterCompile target. In order to override this Target you have to import the Microsoft.Common.targets file.<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />In MSBuild you can call Copy which will move a file from one location to another location. The key word here is that it will move "a file", it will not move "files." So you can call something like this:<Copy SourceFiles="$(DeployStagePath)\my.dll" DestinationFolder="$(DeployPath)" /> But you cannot use code like this to copy all dll files:<Copy SourceFiles="$(DeployStagePath)\*.dll" DestinationFolder="$(DeployPath)" /> To copy all dlls in a folder you need to create a new it…

MOSS 2007 Templates

I needed to have a quick reference guide to the different templates in MOSS 2007 and what each one is for. So here it is. Template CategoryTemplate NameDescriptionCollaborationTeam SiteA site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions.CollaborationBlank SiteA blank site for you to customize based on your requirements.CollaborationDocument WorkspaceA site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document.CollaborationWiki SiteA site for a community to brainstorm and share ideas. It provides Web pages that can be quickly edited to record information and then linked together through keywordsCollaborationBlogA site for a person or team to post ideas, observations, and expertise that site …

WPF Localization - LocBaml

In my last post I talked about using resource files (resx) to localize your WPF application. This time it is about using LocBaml to localize your WPF application. The big difference in the two approaches is that LocBaml allows you to localize your application after the fact. That is, most applications you have to plan up front to do localization, but with LocBaml you can still localize your application after development. While lots of people will say this I don't really believe it. The reason this is not true in my opinion is because LocBaml only works if all your strings are sourced in XAML. This means that if you use strings that are located in a constant file or a resx file LocBaml  will not work to localize your application. Unless you are building a smaller application or you just happen to set up your architecture so all strings are sourced in XAML you are out of luck. So really when they say you can localize your application after the fact you really can only do it if you h…