Thanks to Blair Leduc for pointing out that my Blog entry on Deleting a Project from team Foundation Server is already out of date. The blog entry shows you how to use the command line utility DeleteTeamProject.exe to remove projects from TFS.
This command line utility was renamed to TFSDeleteProject in Beta 3.
Hopefully that is the last time I have to update this post. :)
On November 24th I will be presenting A lap around Visual Studio Team System at the Metro Toronto User Group meeting.
I did this for the CTTDNUG in September, and it was well received. This presentation is light on slides and heavy on Demo's.
I'll try to walk through as much of VSTS as I can without getting to deep into any one topic. If you have never seen VSTS or would like to know what it's all about come on out.
You can register here -> Metro Toronto User Group “A Lap around VSTS”
Have you wondered how to delete a project from Team Foundation Server? There is no way to do it from the Team explorer in Visual Studio. I think this is a good idea. There is however a command line utility called DeleteTeamProject.
DeleteTeamProject [/q] [/domain:] [/force]
[/q] - Quiet mode. Do not prompt the user for confirmation.
[/domain:] - The name of the domain. Necessary in multi-domain environments.
[/force] - Indicates the program should continue even if some parts cannot be deleted.
- The name of the project. Use quotation marks if there are spaces in the name.
You of course require DELETE permission on the project.
Well Snippets are so easy it doesn't make sense not to create them.
I am working on a VB.net 2005 windows application. This client has a very well defined framework. So implementing some feature of the framework is often a matter of finding an example of it in another part of the code then copy and paste. This application was started in VS 2003 and this is primarily what we did. In the beginning we had templates but no one ever wants to keep them up to date as the framework evolves.
Now we have migrated to VS 2005, it's time to take advantage of snippets. So I thought I should try making some, see if it's worth the effort. I was shocked at how easy it is. Let me give you an example: We have a common IU for all forms that display what we define as a document (Order, Product, Customer)
If you have a piece of code to write that is common in your application. You find a sample of the code in another object. You copy it and paste it into your own object then change the names to suite your object. If you take a few minutes and create a code snippet from this the next time it will be that much faster. The time it takes to create the snippet, you will get back the next time you use it.
- There will be no looking for it in another object.
- There will be no removing of the extra stuff from the other example.
- It will be easier to change the names in the new code.
So here is what I did.
First of all to organize your snippets just create a directory structure to store them in. For example in this application there are 4 distinct object types. Representing different layers. This is a windows application therefore we have Windows Forms, Business Objects, Business Entities and Data Access. Therefore I divided the snippets into this directory structure.
YourName
Windows Form
Business Object
Business Entity
Data Access
Now that we have the directory structure all you have to do is open Visual Studio 2005 and select the menu item Tools |Code Snippet Manager... This dialog is a bit confusing at first there is an add and an import button. Import is for importing a single snippet into an existing Folder. Add allows you to add a directory of snippets all at once. So We'll use the add button to add your folder to snippets. The folder names show up in VS when you select the Snippets so choose them carefully. Even if you don't have snippets for each object type yet add the folder anyway. They won't show up until you put snippets in them.
Creating a Snippet
Now lets create a snippet to add to our folders. Snippets are just an XML file. If you like writing XML as much as I do then you will want to find a snippet editor :) . I downloaded a couple but only installed one. I had every intension of trying out a few of them but this one was so easy to use that I had created about 10 snippets before I realized I was still using the first snippet editor. The one I am using is called snippy it's one of the Power toys for Visual Studio 8.
How to use Snippy
First you enter some basic information like the name of the snippet a description of it and your name. The shortcut can be used by the developer to jump straight to this snippet instead of going through the snippet selector.
Then you select the type of snippet. Expansion, Surrounds With, or Refactoring. I have only tried Expansion so far. So that is what we will continue on with. :)

Enter any name spaces you need to include for the code being added.
Now for the code. You have to select the language (C#, VB, J# or XML ) and kind of code you are entering. Then paste the code in. Anything that you want the user to replace at run time just enter a keyword with dollar signs around it. In my example above the object we are creating will have a name (ie: Customer, Order, Product) so I used the keyword object with dollar signs around it where ever I want to replace the ObjectName in the code. When the snippet is inserted into the code the user will be able to tab through the code changing any of the items you have identified as $object$.
Now for the Literals and Objects this is where you create those place holders mentioned in the code section. Click the add button and you can add a literal for anything you put in the code that the user should replace. The ID must be the same as the name you surrounded with dollar signs.
How simple is that?
If you have ever read my blog you know I love IDE tips that make me more productive. I learned a cool new productivity tip for Visual Studio 2005 today. This is just another great benefit to paired programming. Thanks for the tip Eugene.
Tip of the day: If you have a file open in VS 2005 you can quickly close it by simply clicking on it with the wheel of your mouse. That's right a wheel click. Just put your mouse over the tab of the file you want to close and click the wheel on your mouse.
You will also notice some new menu items on the context menu if you right click on the file tab. Check these out.
- Close All But This - Close all open files but this one.
- Copy Full Path - Copies the location path of this file to the clipboard.
- Open Containing Folder - Opens file explorer to the folder containing this file.
Doug Porter was good enough to let me know about a .Net Datawindow 2.0 Web Cast
This is interesting to me for a couple of reasons. As you know I am a fan of the DataWindow. I however have some issues with it in the .net world, because the SQL and UI layers are so tightly coupled. I have been in touch with Sybase over the past year and they have been very responsive to the input of outsiders. One thing I have been asking for is DataSet support. Being able to use a DataSet or DataTable as the Datasource for a .Net Datawindow. Well it's coming, and version 2.0 has it. Dave Fish gave me a demonstration at PDC 05. With this feature you will be able to create a Data Access Layer and still utilize the power of the Datawindow. Once I get my hands on the Beta I will try it out report back here.
This Web Cast will cover the following new features:
- Using .NET Datasets and Datatables as DataWindow datasources
- Visual Studio 2005 Support
- Dot Notation (Indexer) access to DataWindow Data
- Hierarchical (Treeview) Style DataWindow
- Enhanced Drop Down DataWindows for Web Apps
The last day is always quiet. Many have left. Went to a session this morning. Then went to the hands on lab, they were great this year, Blair and I did a Sparkle lab. That was very very cool. Too bad I couldn't capture a video of it. My windows application had a glowing ellipse circling the application and when you changed products the right detail panel flew in like a flip card along with it's reflection. The people working in the labs were developers of the products. I hit a bug in the lab and called someone over they smiled and said I know what's happened that's my bug. :) It was great to get a chance to try it out with the developer right there and be able to talk to them about it. Windows development is going to be very cool in the future.
My first Windows Presentation Foundation Application
So how was my third PDC? I found the organization and logistics excellent. The busses were always there when you walked out. The Attendee party was great and well organized. We had more time at the park then last year. The meals were mostly good. I enjoyed the exhibition hall, lots of vendors. I got to chat with some guys from Sybase that I have talked to on the phone and via email about the .Net Datawindow. The Hands on labs were fantastic.
The content and sessions however were not as good as past years. Some of them I really enjoyed but on a whole I was not as impressed. Mind you there was a lot more new at the last two I attended. The exciting stuff we saw in 2003 had new names but it was still the same stuff. ( WPF - Avalon, WCF - Indigo) A lot of session titles were misleading I thought. I would go to and it would be something different then I was expecting. Maybe I need to read the outline more carefully, but I was not the only one saying this.
What was cool? LINQ is cool. WWF is cool even though it has an unfortunate acronym. VSTS is cool and Whidbey is cool, but they are not new, I have been playing with and demoing them for almost 2 years now. Anders session on C# was great. He told the audience "Please give feedback on these 3.0 features because they are not carved in stone, we haven't even released whidbey yet". That kind of summed it up for me. Maybe next spring would have been a better time for this PDC.
It was so quiet at the conference centre that I headed to the airport and got an earlier flight so I wouldn't have to take the red eye. I'm to old for red eyes. Found Rob Windsor there is noon flight was apparently at 3:10. :)
Now I'm waiting for my DVD of everything so I can watch some of the sessions I didn't make it to.
I attended a great session on C#. Talking about Lambda Expressions, Extension Methods, Object Initializers, Anonymous Types, and Query Expressions. Here are a couple things explained, the others would be way more work then I can handle. We went to Universal Studios last night you know. It was a long and busy day. Which is why I am posting this today.
var
You can use var so you don't have to keep telling the compiler what type the object is.
Instead of... You can do...
int i = 5; var i = 5;
float j = 1.0; var j = 1.0;
string name = “Dave”; var name = “Dave”;
Customer cust = new Customer(); var cust = new Customer();
Object Initializers
You can initialize the properties of a class when you instantiate it.
Customer cust = new Customer { Fname = “Dave“, Lname = “Lloyd“} ;
The compiler turns it into this.
Customer cust = new Customer();
cust.Fname = “Dave“;
cust.Lname = “Lloyd“;
You can nest this to initialize the properties of a class inside another class. So if Customer instantiated two PhoneNumber classes you could do this.
Customer cust = new Customer {
OfficePhone = { Area = “905“, Number = “555-1234” },
MobilePhone = { Area = “905“, Number = “555-4321” }};
You can initialize a collection also this way.
List primes = new List { 2, 3, 5, 7, 11 };
Extension Methods
An extension method is cool, potentially dangerous, but cool. Think of it kind of like an Extender provider for properties. You can create a static method whose first argument must be this. When the compiler sees one of these it brings it into scope for your class. Intellisense will even add it to the list of methods for your class.
Take these Extension methods Where and Select if I just add a using to my code for this Namespace these methods will be extended onto my class.
namespace System.Query
{
public static class Sequence
{
public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate) { … }
public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source,Func<T, S> selector) { … }
…
}
}
using System.Query;
var contacts = customers.Where(c => c.State == "WA").Select(c => c.Name);
That is enough for now. I'm going to see up and coming features of VB now.
Went to the keynote this morning. It was all about servers. Some cool demo's but nothing too exciting. I guess if you get all excited about servers it must have been good.
There was an excellent video before the session started though. Microsoft people talking about a new (GPF) error message box. The error message has two buttons instead of share information and don't share information the buttons on this new dialog read Share Pain and Don't Share Pain. When you click Share pain it shows you video of the developer that wrote the code that caused the crash you just experienced. Then you have three options. Stick them with a pin, electrocute them, flip the back of their seat down and up again to hit them in the back and force their face into their desk. Then when you push the button of choice so you can share your pain with the developer that caused it. :) They even went to the trouble of showing the technology behind the developers chair.
It was very funny.
This morning at the keynote we were shown some new products that Microsoft is coming out with and a new designer for Visual Studio.
The products are touted by Microsoft as their Expression Family of Products they include:
- Acrylic Graphics Designer
This is an editor for manipulating and creating graphics both Vector based and bitmap graphics. The demo was impressive. We'll see.
- Quarts Web Designer
This is a design tool for Web page designers, incorporating CSS, XSLT, Master Pages, ASP.Net.
- Sparkle Interactive Designer
This tool will allow a graphic designer the ability to create a Windows Form (generates XAML) . The demo was a designer and a developer working together on a windows form. One designing a cool interface and the other writing the code.
Visual Studio Tools for Applications
This is the new VBA. Cool demo of extending Auto Cad to include purchase and pricing information for a component right from a Cad drawing.
Windows Workflow Foundation
This is very cool. It's a work flow designer for Visual Studio. You can create your own workflow activities and reuse them from the toolbox. Check out Barry's Blog for more information and linkns to other resources.