Sunday, December 23, 2007

Visual Studio Team System 2008 Team Foundation Server MSSCCI Provider

The Visual Studio Team System 2008 Team Foundation Server MSSCCI Provider enables integrated use of Team Foundation Version Control with products that do not support Team Explorer integration. You can download it from here.

This version (1.2) includes:

  • Enable handling branched solutions in Visual Studio 2003.
  • Fixed issues to enable provider to support Toad for SQL Server 2.0.
  • Enhanced the "Choose Folder in Team Foundation Server" dialog.
  • Fixed bug which prevented Properties Dialog from displaying local path.
  • Work Items Query list in the Checkin Dialog is loaded and saved on the disk.
  • "Get" operation performance improvements.
  • Defect fixes

Download MSSCCI provider for VSTS 2008.

Friday, December 21, 2007

Team Foundation Power Tools for VS2008

Ed Hintz just announced the Team Foundation Power Tools for VS2008 are now available:

The Team Foundation Power Tools for VS2008 are now available here.  This is the first release of the Power Tools that work with VS2008.  We did not want to just deliver a warmed over version of the VS2005 Power Tools, so we included lot of new goodies in this release.

It includes:

  • Find In Source Control
  • Quick Label
  • Process Template Editor
  • Open in Windows Explorer
  • Team Build Notificationapplet
  • More commands...

Click here for download.

Thursday, December 20, 2007

What Is Your TFS Configuration?

The VSTS team are working on some test planning for the next release of Team Foundation Server. One area they’re focused on is testing various possible configurations of TFS.

MS is trying to get a picture of the variety of ways that people have their TFS installations configured.  Read Chris's blog post on what they are doing and why. There is a short survey (10 questions) with no need to provide any sensitive data. Fill it out and help them to make sure that the configurations they test map to ones actually deployed ‘in the wild’. If you own or manage multiple TFS deployments, you can fill out the survey once for each.

So go and fill out the 10-question survey here for each deployment you have.

Monday, December 17, 2007

Recordings From Dev Academy 2 Available

If you want to see the sessions from Microsoft Developers Academy 2 you can do it. 

Enjoy!

DevAcademyII

Sunday, December 16, 2007

No Scroll Bar In The Data Dude Schema View

You won't find it.

There's no horizontal scroll bar in the schema view window like there is in the solution explorer (or other views).

The problem relevant for VS 2005 as also VS 2008.

scroll

Thursday, December 13, 2007

Custom Build Number In Team Build

Many users want to modify the default build number of Team System Team Build which looks like: <Build-Type-Name>_<Date>.XXX.

You can change it by writing a custom task and call it in the BuildNumberOverrideTarget target of the MSBuild file. In this example the task will generate a unique build number based on current time:

using System;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;


namespace MaorDavidBlog.Samples.MSBuild
{
public class BuildNameGenerator:Task
{

private string _buildName;

public override bool Execute()

{
_buildName = DateTime.UtcNow.ToString();
return true;
}



[Output]
public string BuildName

{
get { return _buildName; }
}

}
}


The attribute “Output” indicates that BuildName property is output of the custom task.



Then, register the task in TFSBuild.proj file.



<!-- Add using task line just after import statement - - >
<UsingTask
TaskName="MaorDavidBlog.Samples.MSBuild.BuildNameGenerator"
AssemblyFile="$(MyCustomTasks)\MaorDavidBlog.Samples.MSBuild.dll"/>



<! -- Override the target towards the end of proj file - - >
<Target Name = "BuildNumberOverrideTarget" >
<BuildNameGenerator>
<Output TaskParameter="BuildName"
PropertyName="BuildName"/>
</BuildNameGenerator>
</Target>


 



Next time you'll execute your build, you'll see your custom build name.

Wednesday, December 12, 2007

Copy WildCards With MSBuild

I got today hysterical message from a good friend that implementing in his company automatic build with Team System. The message was: "Maor, How can I copy wildcards With MSBuild? Please help!!!".

Okay. What you should do my dear friend is:

1. Create an item list if you have more than one file to copy. You can do it with the CreateItem task:

<CreateItem Include="$(MyDir)\*.*">
<Output TaskParameter="Include" ItemName="MyFilesToCopy" />
</CreateItem>


2. Copy!



<Copy SourceFiles="@(MyFilesToCopy)" DesginationFolder="$(MyPutputDir)" />


3. Execute your build script.



Ah, by the way, if you want to recursively copy files using the <Copy> task, read this post from MSBuild Team Blog.



Enjoy!

Automatically Compare Data and Schema Using MSBuild and Data Dude

VSTS for DB Professionals (aka "Data Dude" or "VSDBPro") provides great tools for schema and data compare.

Like most Visual Studio-based project systems, the core tasks inside the VSDBPro project implemented as MSBuild tasks. The two core activities for Database Projects (.dbproj), “Build” and “Deploy” are implemented by two MSBuild tasks named “SqlBuildTask” and “SqlDeployTask.”

Sometimes, we also need to automate the schema and data compare processes. We can do it with new MSBuild dedicated tasks that shipped with Power Tools for Data Dude:(Currently available for VSTS 2005)

  • SqlDataCompareTask: allows you to compare the content of tables within two databases from the command line using MSBuild
  • SqlSchemaCompareTask: allows you to compare schemas between two database from the command line using MSBuild

How should you use it?

First, install the Power Tools. Download from here. (notice that the power tools requires Data Dude Service Release 1 installed).

After you installed the power tools you can use the tasks in your MSBuild script.

Example:

  <!--Import the settings-->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0
\TeamData\Microsoft.VisualStudio.TeamSystem.Data.PowerTools.Tasks.targets"
/>

<Target Name ="DataCompare">
<SqlDataCompareTask
SourceConnectionString="Data Source=(.);Integrated Security=True;Pooling=False"
SourceDatabaseName="SourceDB"
TargetConnectionString="Data Source=(.);Integrated Security=True;Pooling=False"
TargetDatabaseName="TargetDB"
OutputPath = "$(temp)"
OutputFileName = "DataCompare.sql"/>
</Target>


Notice that the task does not allow you to compare against the project right now. Same way you can use the SqlSchemaCompareTask.



<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0
\TeamData\Microsoft.VisualStudio.TeamSystem.Data.PowerTools.Tasks.targets"
/>
<Target Name ="SchemaCompare">
<SqlSchemaCompareTask
SourceConnectionString="$(SourceConnectionString)"
SourceDatabaseName="$(TargetDatabase)"
TargetConnectionString="$(TargetConnectionString)"
TargetDatabaseName="$(TargetDatabase)"
OutputPath = "$(IntermediateOutputPath)"
OutputFileName = "$(TargetDatabase)SchemaCompare.sql"
IgnoreChecks ="true"
/>
</Target>


The properties exposed by the MSBuild tasks are documented via an accompanying XSD file located in:



%ProgramFiles%\Microsoft Visual Studio 
8\Xml\Schemas\1033\MSBuild\Microsoft.VisualStudio.TeamSystem.Data.PowerTools.Tasks.xsd

Tuesday, December 11, 2007

How To: Build Non-MSBuild Projects with MSBuild

Building non-MSBuild projects is possible. For example you have to build VS2003, Installer, C++, Delphi projects etc. How can you do it? It's simple.

The MSBuild has a built-in task: Exec task. This task calls cmd.exe instead of directly invoking a process and runs the specified program or command with the specified arguments. You can use it in order to build non-MSBuild projects.

For example, in order to build a Visual Studio 2003 Project you should modify the MSBuild file as:

   1:  <PropertyGroup>


   2:  <VS2003_Devenv>$(ProgramFiles)\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com</VS2003_Devenv>


   3:  <VS2003_SolutionName>$(SolutionRoot)\vs2003\VS2003Application\VS2003SLN.sln</VS2003_SolutionName>


   4:  <VS2003_Configuration>Debug</VS2003_Configuration>


   5:  </PropertyGroup>


   6:   


   7:   


   8:  <Target Name="AfterCompile">


   9:  <Exec Command="&quot;$(VS2003_Devenv)&quot; &quot;$(VS2003_SolutionName)&quot; /build $(VS2003_Configuration)"/>


  10:   


  11:  <MakeDir


  12:  Directories="$(BinariesRoot)\$(VS2003_Configuration)"


  13:  Condition="!Exists('$(BinariesRoot)\$(VS2003_Configuration)')" />


  14:   


  15:  <Copy


  16:  SourceFiles="$(SolutionRoot)\vs2003\VS2003Application\bin\$(VS2003_Configuration)\**\*.*"      


  17:  DestinationFiles="$(SolutionRoot)\vs2003\VS2003Application\bin\$(VS2003_Configuration)\**\*.* ->'$(BinariesRoot)\$(VS2003_Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"


  18:  />


  19:  </Target>



Read here for more information about the target names and the MSBuild configuration file.



First declare some variables to use them during the build. (Lines 1 - 5) . Next in the AfterCompile target, use the MSBuild Exec task to build the VS2003 project by invoking the devenv.com program (Lines 9 -10). After that make a directory (using MakeDir task) for the output (if not exists) (Lines 11 - 13). Finally copy (using the Copy task)the output files to the build binaries root (Lines 15 - 18).



Notice that this assumes VS 2003 is installed on the build machine.



Good Luck!

Monday, December 10, 2007

Data Dude: How to Select From Other Database Server

When you have a View or other T-SQL Select statement that referenced to other server (even Oracle) , the VSTS for DB Professionals returns TSD4001: Could not find server SERVER NAME. Now build and deployment of the SQL Server database are blocked.

What can you do in order to solve it? the best workaround is to make sure the scripts are using 4 part names (ServerName.DatabaseName.DatabaseOwner.TableName) and you add the linked servers to the design database server. After that, you should be able to get the error to go away and you might be left with a warning about the cross-server dependencies not being able to be verified, but that shouldn't block your build and deployment of the SQL Server database.

ADO.NET Data Services ("Project Astoria") CTP is Released

Earlier this day I wrote about the release of ASP.NET 3.5 Extensions Preview release . The ASP.NET 3.5 Extensions Preview is a new release that provides new functionality being added to ASP.NET 3.5 and ADO.NET in 2008. This release delivers a set of new features that target:

  1. Enabling High Productivity Data Scenarios - including MVC, Entity Framework, ADO.NET Data Services and dynamic data
  2. Supporting Test Driven Development - including a powerful and extensible MVC framework
  3. Creating the best server for Rich Clients - including Ajax history support and Silverlight controls for ASP.NET

This release also includes the first CTP of the production version of ADO.NET Data Services (aka "Astoria") .

ADO.NET Data Services

ADO.NET Data Services provide new services that find, manipulate and deliver data over the web using simple URIs. Benefits include an easy and flexible way to access data over the web, while enabling the separation of presentation and data access code.

Astoria team blog: http://blogs.msdn.com/astoriateam/default.aspx

ASP.NET 3.5 Extensions Preview Released

The ASP.NET 3.5 Extensions Preview is a preview of new functionality being added to ASP.NET 3.5 and ADO.NET. The release includes an ASP.NET MVC, ASP.NET Dynamic Data, Silverlight controls for ASP.NET, ADO.NET Data Services, Entity Framework runtime, and new features for ASP.NET AJAX.

HTML helpers pages: ASP.NET MVC Preview: Using The MVC UI Helpers

How to Unit Testing with MVC: TDD and Dependency Injection with ASP.NET MVC

Sunday, December 9, 2007

Team Explorer 2008 Download

To connect to Team Foundation Server, you must run a separate installer for Team Explorer. This installer is located in the [Drive]:\TFC\ folder on both the Team Suite 2008 media and the Team Foundation Server 2008 media.

Team Explorer 2008  is now also available to download.

Download Visual Studio Team Explorer 2008 (~384mb).

Technorati Tags:

GMAIL New Feature

Do you need help with keyboard shortcuts in Gmail? Just type ? (question mark) and you'll see a list of the most important keyboard shortcuts. To use it, you need to enable keyword shortcuts in the Settings before using them (the option is disabled by default).

I really like it!

GmailHelp

Technorati Tags: ,

Pro LINQ: Language Integrated Query in C# 2008 - Early Review

LINQ I like LINQ and I posted about it in my blog.

In the last 2 weeks I have been reading the book Pro LINQ: Language Integrated Query in C# 2008  by Joseph C. Rattz, Jr.  | ISBN: 1-59059-789-3 which I have had access to via the Early Access Program as a PDF ebook.

This book provides superb coverage of LINQ where it shows the reader how to leverage all the new LINQ C# 2008 language features including extension methods, lambda expressions, anonymous data types, and partial methods.

The book refers to all kinds of LINQ including LINQ to Objects, LINQ to SQL, LINQ to XML, LINQ to DataSet. The book starts with an introduction of what LINQ is (the first and second chapters, "Hello LINQ" & "C# 3.0 Language Enhancements for LINQ") and builds this more and more throughout the book and the next chapters.  Even if you don't a proficient C# developer, you'll find the book useful. It provides a very good high level overview of all the sections, however goes deep into the inner works of LINQ.

The question whether to use LINQ or not is answered: the book gives you an in-depth understanding about LINQ when and where it is required. 

I like the writing style to Joseph: at eye level and very coherent.

If LINQ interesting you and you would like to know it well - I highly recommend you get this book. Once I get the final version of the book, I will give it another read.

You can download the first chapter for free:

http://www.apress.com/book/view/1590597893

Table of Contents

PART 1 Pro LINQ: Language Integrated Query in C# 2008
CHAPTER 1 Hello LINQ
CHAPTER 2 C# 3.0 Language Enhancements for LINQ


PART 2 LINQ to Objects
CHAPTER 3 LINQ to Objects Introduction
CHAPTER 4 Deferred Operators
CHAPTER 5 Nondeferred Operators


PART 3 LINQ to XML
CHAPTER 6 LINQ to XML Introduction
CHAPTER 7 The LINQ to XML API
CHAPTER 8 LINQ to XML Operators
CHAPTER 9 Additional XML Capabilities


PART 4  LINQ to DataSet
CHAPTER 10 LINQ to DataSet Operators
CHAPTER 11 Additional DataSet Capabilities


PART 5 LINQ to SQL
CHAPTER 12 LINQ to SQL Introduction
CHAPTER 13 LINQ to SQL Tips and Tools
CHAPTER 14 LINQ to SQL Database Operations
CHAPTER 15 LINQ to SQL Entity Classes
CHAPTER 16 The DataContext
CHAPTER 17 Concurrency Conflicts
CHAPTER 18 Additional SQL Capabilities

 

Technorati Tags:

Saturday, December 8, 2007

Building VS 2008 projects with TFS 2005

When you try to build VS 2008 solutions with Team Foundation Build 2005 you get:

MSB5014 - File format version is not recognized.

I posted about it and one of the comments (by Eran Kampf) linked to Mitch Denny's approach. Customers ask me about it a lot and this is the best approach to deal with the problem.

Buck Hodges says that the best "workaround" is to upgrade to TFS 2008. But not all of you will upgrade soon to 2008. For you, Mitch's approach is the best.

Technorati Tags: ,

Team System Chat Summary

There is a copy of the evening edition of Team System Chat. You can find it here.

Technorati Tags:

Announcing Volta: Web Development Using Only the Materials in the Room

volta Just released from Microsoft Live Labs: Volta.

Volta is another codename project from Microsoft that aims at Web UI experience.

 

The Volta technology preview is a developer toolset that enables you to build multi-tier web applications by applying familiar techniques and patterns. First, design and build your application as a .NET client application, then assign the portions of the application to run on the server and the client tiers late in the development process. The compiler creates cross-browser JavaScript for the client tier, web services for the server tier, and communication,erialization, synchronization, security, and other boilerplate code to tie the tiers together.

See detailed architectural and fundamental description here.

Technorati Tags:

MVC vs MVP

MVC or MVP? You've probably heard about Microsoft's new ASP.NET MVC Framework.

MVC methodology divides an application's implementation into three component roles:

  • Models
  • Views
  • Controllers.

MVP approach divides an application's implementation into:

  • Model
  • View
  • Presenter

What is the difference between the  MVC and MVP patterns?  Todd Snyder has an excellent explanation. This is summary by the key differences between the two patterns:

MVP MVC
View is more loosely coupled to the model. The presenter is responsible for binding the model to the view Controller are based on behaviors and can be shared across views
Easier to unit test because interaction with the view is through an interface Can be responsible for determining which view to display
Usually view to presenter map one to one. Complex views may have multi presenters  

 

Technorati Tags: ,,

Free Web.Config Editor

a nice tools which helps a lot in editing Web.Config and Application.Config files published at Microsoft Public Sector Developer and Platform Evangelism Team Blog.

You can download it from: http://asphere.aspweb.cz/default.aspx

web.config editor

Technorati Tags:

Sunday, December 2, 2007

Team Foundation Build 2008 New Features Video

There's a great new video on MSDN by Richard Hundhausen introducing the new features in Team Foundation Build 2008: How Do I: Learn the New Features and Capabilities of Team Foundation Build 2008?

The video covers the major new features and provides a great introduction to the product.

Saturday, December 1, 2007

VSTS Web Access Power Tool for Team System 2008 released

Today Microsoft released the final version of the Team System Web Access (TSWA) 2008 power tool!  Team System Web Access provides a web interface to Team Foundation Server 2008.

Here's a list of feature changes (the release also included bug fixed).

(List from Buck's post)

  • New direct links: Previously, you could construct a direct link to a work item (http://mytfs:8090/wi.aspx?id=123).  Now you can also construct direct links to more features, and the direct links no longer open the main TSWA page, making them more responsive.  Keep reading to find out how to use them.
  • Performance improvements: The code now uses server memory more efficiently, resulting in increased performance.
  • Custom work item controls: First introduced in the CTP, MS continued to refine support for custom work item controls in TSWA.  To take advantage of this feature, you'll need to implement web versions of your existing custom controls.  You'll find documentation for it in the SDK folder underneath the folder where you install TSWA.  The following examples have been added since the CTP, in addition to the samples for checkbox, a work item picker, and a multi-value selector.
    • How to validate a work item on the client-side (Javascript)
    • How to validate a work item on the server-side
    • How to design a control whose field depends on the values of other fields
    • How to design a control that changes other field values (such as the WI state) and saves the work item
  • Team Build 2008 support: Also introduced in the CTP, you can view the build queue and queue new builds, which are features that are new for TFS 2008.

Full details you can find at Buck's post: http://blogs.msdn.com/buckh/archive/2007/11/29/team-system-web-access-2008-power-tool-is-now-available.aspx

 

Technorati Tags: ,

Thursday, November 29, 2007

Visual Studio Team System 2008 Database Edition

vsdb

What has changed for Visual Studio Team Edition for Database Professionals (aka VSDB, DB Dude) in the 2008 edition?

  1. Installation: No more additional setup. In Visual Studio Team System 2008 VSDB completely integrated in the standard setup, so no more additional downloads. All you have to do is to make sure the Team Database Edition option is checked in the features to install window.  The database project functionality is only available in two of the Visual Studio Team System SKU's:
    • Visual Studio Team System 2008 Database Edition.
    • Visual Studio Team System 2008 Team Suite.
  2. The Visual Studio Team System 2008 Database Edition is based on the v1.0 functionality plus the Service Release 1 functionality.
  3. Solution Explorer performance improvements, especially when your project has large number of objects stored under a single node instead Solution Explorer.

What about the great features of VSDB 2005 power tools?  Not available yet. MS trying to release a new VSDB 2008 Power Tools release targeting later this month.

Wednesday, November 28, 2007

Rosario November CTP is now available

According to Jeff Beehler:

I'm happy to announce that the next Community Technology Preview of Rosario (officially known as Microsoft® Visual Studio® Team System code name “Rosario” November 2007 CTP) is now available.  Customers can immediately begin downloading the VPC images from our download page.

Download and check what's coming up next for Visual Studio Team System!

 

Technorati Tags: ,

Visual Studio Team System chat - December 5, 2007

Do you want to discuss features available in Team Foundation Server, Team Suite, Architecture Edition, Development Edition, Database Edition, and Test Edition? You can join members of the Visual Studio Team System product group chats.

There will be two chat sessions.  (times in the Jerusalem time zone)

  • Join the chat on Wednesday, December 5th, 2007 from 20:00 - 21:00 Jerusalem Time. Add to Calendar
  • Join the chat on Thursday, December 6th, 2007 from 02:00AM - 03:00AM Jerusalem Time. Add to Calendar

DEV215: Presentation and Demo Download

I uploaded my presentation, done in DevAcademy2. Now you can download, use and review it.

Presentation - DEV215 Integrating Databases Into ALM

Demo -  DEV215 Integrating Databases Into ALM

DevAcademy2 Summary

Yesterday I presented at DevAcademy II event - an annual developers event organized by Microsoft Israel. It was a great event and highly-professional. I really enjoyed it.

A big thanks to Microsoft Israel for the technical and logistical planning and execution of this event.  Both speakers and attendees commented it was great and professional.

I'll post later the download link of my presentation and demos -  DEV215: Integrating Databases Into ALM.

See you in the next event!

Photos - Thanks to Mr. Adi Avnit.

27Nov_0002

27Nov_0001

Monday, November 19, 2007

How would you spend $100 on MSBuild?

Dan Moseley, a developer on the MSBuild team, wants to know how you would prioritize features for the next version of MSBuild by asking, How would you spend $100 on MSBuild?

This is a great opportunity to influence the future of MSBuild, so be sure to post your opinion.

My choice:

Visualization - $30

Msbuild debugger - $25

Vc support - $20

Extensible functions - $5

Inline tasks  - $20

 

Technorati Tags:

Dual boot: Vista and Win Server 2003

Wow! It was a long long long installation weekend. My Laptop's hard disk died a week ago, and I got new one which means installations!

I need both Vista and Server 2003 with Dual boot configuration on my laptop. Vista is my work and development machine, server 2003 hosted Team Foundation Server - my presentations machine.

It seems that this is not so easy to configure dual boot with Vista...after 2 formats and re-installation I finally succeeded!

Why does it so complicated? earlier versions of the Windows are incompatible with the new Windows Vista startup method. Windows Vista uses a new Boot Configuration Database (BCD) store. This store contains a boot menu and all the information about operating systems that are installed on the computer. Therefore, a Boot.ini file that is from an earlier version of the Windows operating system cannot be used to start Windows Vista.

How did I solve it? I found this useful KB and a great tool: EasyBCD.

Next time I'll be smarter...

Technorati Tags: ,

Thursday, November 15, 2007

Team Foundation Server 2008 Installation Problems

I just installed Team Foundation Server 2008 and I got couple of errors during installation. Even I had followed the installation guide to the letter, I got some errors:

  • Error 28905: WiDbLoc: Could not list of fields to localize from the database. Clicking Retry wasn't the appropriate workaround...I found this post and I understand that after I changed SQL Server's TCP/IP status of the enabled, I didn't restart the SQL Server service. Restart it and the error disappeared.
  • Setup Error 28100: Failed to load EventService proxy object: Requested registry access is not allowed.  Do not interrupt the installation! Thanks to Xenopz Blog I found the workaround to fix it.  Execute:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN>stsadm -o addpath -url http://localhost/Reports -type exclusion

The virtual server that is referenced here is not in the config database. After starting the sptimer (execute "net start sptimer" on the command prompt) and restarting IIS, the installation continued without problems.

Technorati Tags: ,

Monday, November 12, 2007

LINQBridge - Use LINQ to objects in .NET 2.0

I really like LINQ, but what if I want to use it and the target framework is not .NET 3.5? There is a way to use LINQ to Objects in .NET 2.0 projects. LINQBridge makes this possible. I saw it today but I didn't try it yet. (I'll be soon)

How it works?

First, it's important to understand that C# 3.0 and Framework 3.5 are designed to work with CLR 2.0-the same CLR version that Framework 2.0 uses. This means that the C# 3.0 compiler emits IL code that runs on the same virtual machine as before.

This makes Framework 3.5 additive-just as Framework 3.0 was additive-comprising additional assemblies that enhance the existing 2.0 Framework and CLR. So there's nothing to stop us from writing our own assemblies that do the work of Framework 3.5 (at least, the critical bits required for local LINQ queries).

Go to LINQBridge official page - you'll find there more info as well as source code.

Technorati Tags:

Saturday, November 10, 2007

Visual Studio 2008 Training Videos

Ready to learn about Visual Studio 2008? How it will make you more productive? Check out the training videos below.

http://msdn2.microsoft.com/en-us/vstudio/bb655906.aspx

You can signup to MS Developer Academy

Event: Microsoft Developer Academy II

Event ID: 1032359731

Date: 27/11/2007

Location: Airport city (near Ben-Gurion airport) at Avenue convention center

Register now, before it's too late. This time, only registered users can attend in the event. So hurry up...

Yo can signup here.

My session:

Where: Arava Hall

When: 13:15-14:30

About: Integrating the database into application lifecycle management with Visual Studio Team System for Database Professional. Read more...

So signup and see you there.

Tuesday, November 6, 2007

VS2008 Language Support Presentation

You can download the first part of my presentation about VS2008.

The first part is about the new language features.

The agenda:

  • Multi-Targeting Support in VS 2008
  • Object Initializes
  • Lambda Expressions
  • Var Keyword
  • Automatic Properties
  • Extension Methods
  • Anonymous Types

Download from here.

Enjoy!

Monday, November 5, 2007

Release Date for Visual Studio 2008 and the .NET Framework 3.5

vs2008 Microsoft announced today that Visual Studio 2008 will be released before the end of November 2007.  Great News!

 

Technorati Tags:

Sunday, November 4, 2007

.NET Framework 3.5 Commonly Used Types and Namespaces poster

Paul Andrew introduced the .NET Framework 3.5 update to the Commonly Used Types and Namespaces poster. You can download it from here. (PDF version).

Technorati Tags:

Saturday, November 3, 2007

TFS Build Lab 1.0 Released

UntitledTFSBuildLab 1.0 is released on CodePlex.  

This is a project to simplify the day to day operations when using automated builds on TFS.

This project handles common Team System issues such as:

  • Continuous integration builds
  • Scheduled builds
  • Build queuing
  • Event notifications
  • Manual and automated build cleanup

What features included in V1.0:

Service

  • Automatic rescheduling when adding new scheduled trigger.
  • A report for displaying statistics from the triggers and retention policies.
  • Support for overriding build script parameters both for CI and queued builds.
  • Support for only deleting the build drops.
  • Support for configuring retention policies based on build quality.
  • Performance improvements by introducing caching

Admin Client

  • Added feedback when deleting multiple builds.
  • Support for forcing reaching on the server.
  • Support for overriding build script parameters on queued builds.
  • Support for overriding build script parameters on triggers.
  • Added range parameters when listing log entries to limit the result data.

Checkin Policies

  • Removed the need for TfsBuildLab when using the restricted paths policy.
Technorati Tags: , ,

Friday, November 2, 2007

Top Posts From October

Cross posted from: http://blog.maordavid.com

Well, October was an interesting month. I wrote 30 posts, and these are the 5 posts you mostly interested:top5

  1. Query XML using XLINQ - How to query XML data using XLinq.
  2. C# Coding standards guideline - a guideline which was written by Juval Lowy.
  3. Linq to XML - Adding,Updating and Deleting data - How to add,update and delete XML data using Linq.
  4. I Search with Google’s experimental - new from Google Labs: Experimental search. I explain there what is it and how to use it.
  5. Reset autonumber (IDENTITY) column in SQL Server - How to reset the autonumber - identity column in a table.

That is my review of October posts. Comments, suggestions and links to things you think I should be talking about always welcome.

Thanks for reading!

Tuesday, October 30, 2007

New version of Gmail is Here!

New version of Gmail is already available in some Gmail accounts. If you see a link to a "newer version" at the top of the page, click on it and enjoy the new features:

  • Prefetching messages: When you load a page that contains a list of messages, Gmail will fetch them in advance so that when you need them, they'll be available instantly. Google said that Gmail will have a completely new JavaScript architecture that will bring a much better performance.
  • A new contact manager that will be shared with other Google apps (Google Docs, Google Calendar etc.)

Just to remind you, the previous gift from Google was a bigger mailbox's size.

Not all accounts got the new version, but during the next days I believe it will happen.

Enjoy!!

gmail

Technorati Tags:

WPF Composite Client

After the announcement about the death of Acropolis, Glenn just announced that the patterns & practices team will develop WPF Composite Client guidance for building composite client applications for .NET Framework 3.5 and Visual Studio 2008. This is not a new version of CAB . It is an entirely new set of  libraries and guidance, built from the ground up, targeting development of new WPF Composite applications. The target is to have all of the new guidance ship before the end of 2008.

Acropolis - The end

The Acropolis team just announced today that Acropolis will not advance from CTP to a supported release. They also announced that they want to help customers who'd like to take Acropolis into production be successful until an alternative is available.
The good news is that all the great work the Acropolis team did will be rolled out in the future versions of .NET and also used for guidance and best practices for building WPF Composite Clients.

Saturday, October 27, 2007

Data Dude: Synchronize vs Refresh

What the difference is between the "Refresh" button in "Solution Explorer" and the "Synchronize" button in "Schema View?

I was confused too, until I read Gert's post about it.

Synchronize - refers to synchronization of state between the Solution Explorer and Schema View.

Refresh - cause a complete reload of all schema objects (reading all files from links from the project file); parse the fragments and execute them against the design validation database.

Technorati Tags:

Code Analysis in VS 2008

VS 2005 introduced internal static analysis tools. This helps you to write secure and quality code.

Visual Studio 2008 has new Code Analysis features:

  • Code Metrics - This gives you the ability to dig deep to find those un-maintainable and complex hotspots. Code Metrics will ship with five metrics - Cyclomatic Complexity, Depth of Inheritance, Class Coupling, Lines of Code and Maintainability Index.
  • Analysis improvements:
    • Support for analyzing anonymous methods and lambda expressions
    • Reduced noise in existing analysis and the ability to skip over tool generated code
    • New analysis, including additional rules around security, globalization, maintainability and spelling.

 

To generate code metrics, simply do the following:In Solution Explorer, right-click on your solution/project and choose Generate Code Metrics

runCM

After generation you'll get the Code Metrics Results window and a tooltip on every column that explain the result. The Maintainability Index column includes a maintainability indicator light that changes based on the maintainability of the code. Green indicates good maintainability, yellow indicates moderate maintainability, and red indicates poor maintainability.

cmResults

 

Technorati Tags: ,

Friday, October 26, 2007

My session at Dev Academy 2007

Do you want to know how VSTS for database professionals helps you to take control on your database change? or how you can ensure you software quality? How can you write and execute unit tests for your database objects? devAcademy

You can get the answers and even more details and great features in the next Developers Conference here in Israel - Developer Academy 2.

I will be giving a there a session about VSTS for database professionals. If you work with databases then you will want to see the new capabilities offered by the latest addition to Visual Studio Team System from Microsoft. In this session, you will learn how this product will change the way you work with databases forever; you will get a look at how Visual Studio Team Edition for Database Professionals is used to help with Database development, Database Unit Testing, Database Refactoring, Code-Analysis for Database and Database deployment.

If you want to see more, or you have a question - post a comment.

See you there!

VS 2008 VPCs will expire on Nov 1st 2007

If you are using the VPC provided by Microsoft to evaluation Visual Studio and Team Foundation Server 2008 Beta2 be aware it will expire Nov 1st. 

See Jeff Beehler's post for more details.

Wednesday, October 24, 2007

Build a labeled version with TeamBuild

This is the 3rd post in the series of posts about MSBuild. You can read them at:

  1. Introduction to MSBuild.
  2. Create custom task to MSBuild - step by step.

As you know, TeamBuild builds the latest version by default. At the Target "CoreGet" in the MSBuild script (you can find it at Microsoft.TeamFoundation.Build.targets file), it gets the latest version from source control to the local workspace on the build machine and build the source.

To build a labeled source you have to set a value to the Version property of the Get task in this target.

So, all you need to do is to override the CoreGet target in the TfsBuild.proj file (it's better than override it in the target file because if you do so, this change will affect all builds on the machine...):

   1:  <Target Name="CoreGet"
   2:        Condition=" '$(IsDesktopBuild)'!='true' "
   3:        DependsOnTargets="$(CoreGetDependsOn)" >
   4:   
   5:      <!-- Get all the latest sources from the given workspace-->
   6:      <Get Condition=" '$(SkipGet)'!='true' "
   7:          Workspace="$(WorkspaceName)"
   8:          Recursive="$(RecursiveGet)"
   9:          Force="$(ForceGet)"
  10:          Version="$(VersionToBuild)" />      
  11:  </Target>

The property in line 10 is the property that do the work...


You can declare the $VersionToBuild variable at the PropertyGroup element or by passing this value from the .rsp file. The easiest way is to declare it at the PropertyGroup element.


   1:  <PropertyGroup>
   2:      <VersionToBuild>M_1.0.0.223</VersionToBuild>
   3:  </PropertyGroup>

That's all!


Enjoy.


Technorati Tags: ,

Open source at Microsoft

There is new open source site from Microsoft.

Microsoft opened a number of sites to host open source projects like GotDotNet, CodePlex, and now this one.  This site doesn't replace CodePlex. This site is intended to provide information about Microsoft and open source in one place, serving as a gateway for information about open source engagements and activities across Microsoft.

Technorati Tags:

10 Warning Signs of Project Failure

This is a great article that outlines the 10 signs that a project is going to fail which written by Allen Bernard.

What are the signs you agree with? I think that Undefined or poorly defined project requirements and lack of or poorly developed budget forecast are the real problems.

Technorati Tags:

Astoria DataSource Extender

PhaniRajuYN posted a very interesting post about Astoria DataSource Extender. (You can read my Getting Started With Astoria post to get more details about Astoria). The main issue is that it's a "Database in the cloud", which means that your database is hosted on the Web.

PhaniRajuYN Extender helps one retrieve data and post data to a database on Astoria using JavaScript.
The Extender encapsulates its own Server-Side handler so that  you don't have to write a Server-Side proxy to avoid Making Cross-Domain Requests from the Client browser.

You can read the post and download the source and sample from here.

Saturday, October 20, 2007

How to prevent SQL injections

Many applications include code that looks like:

   1:  string sqlStmt = "SELECT * FROM USERS WHERE UserName= '" + un + "' AND Password='" + pwd + "'";

Admit it...it's ugly, but you constructed SQL statements like this one.


The variables un,pwd are provided by the user. The problem with this SQL string is that the attacker can piggyback SQL statements in one of them.


What if the attacker enters this:


un = maor, pwd = 123456' OR 1=1. The following malicious statement is built:


   1:  string sqlStmt = "SELECT * FROM USERS WHERE UserName= 'maor' AND Password='123456' OR 1=1";

The statement will return all columns for all rows...Bad!


And what if the attacker enters this:


un=maor , pwd = 123456' DROP TABLE Users. The following malicious statement is built:


   1:  string sqlStmt = "SELECT * FROM USERS WHERE UserName= 'maor' AND Password='123456' DROP TABLE Users";

This builds SQL statement that queries for a user and then drops the users table.


What can you do prevent these attacks?


1. Quoting the input


Quoting the input is not a remedy, but its often proposed to solve the problem.


if we use the statement of:


   1:  string pwd;
   2:  pwd = pwd.Replace("'","''");

The code replaces single quotes with 2 single quotes in the input. The single quote is escaped and its render to invalid SQL statement. However its not perfect. If the statement has a integer field the attacker can use it to attack.


2. Use stored procedures


Many of us probably believe that the application is immune to SQL injection if we use stored procedures. WRONG!


When we enter the 123456' OR 1=1 to a parameter the sp will fail cause we cannot perform join across a stored procedure call. However, performing data manipulation is valid.


   1:  exec sp_getUser 'maor','123456' INSERT INTO Users Values('123','123')

This command will fetch data about the user and then insert a new row into the users table! What we can do? secure the stored procedure. How?



  1. Use quotename function for object names. It's built in T-SQL function that adds delimiters to object names to help nullify invalid characters.
  2. Use sp_executesql to execute sql statements built dynamically, instead of just concatenating a string. This makes sure no malformed parameters are passed along to the database server.

3. Never connect as sysadmin


If you see that your web application connects to the database as sysadmin account - its a BUG. Most of the web applications don't need the capabilities of a sysadmin to run; If there is a bug in the SQL statements and the application connects as sysadmin account, the attacker can: delete any database or table in the server; delete any table data; change data; alter tables; deletes log; and more... The potential damage is unlimited.


4. Build secure SQL statements


Instead of dynamically building a string, as shown in the bad examples above, use parameters. Anything placed into a parameter will be treated as field data, not part of the SQL statement, which makes your application much more secure.


Using parameterized queries is a three step process:


  1. Construct the SqlCommand command string with parameters.
  2. Declare a SqlParameter object, assigning values as appropriate.
  3. Assign the SqlParameter object to the SqlCommand object's Parameters property.

   1:  // 1. declare command object with parameter
   2:  SqlCommand cmd = new SqlCommand(
   3:      "SELECT * FROM USERS WHERE UserName= @UN AND Password= @PWD", conn);
   4:   
   5:  // 2. define parameters used in command object
   6:  SqlParameter param1 = new SqlParameter();
   7:  param1.ParameterName = "@UN";
   8:  param1.Value = userName;
   9:   
  10:  SqlParameter param2 = new SqlParameter();
  11:  param2.ParameterName = "@PWD";
  12:  param2.Value = password;
  13:   
  14:   
  15:  // 3. add new parameter to command object
  16:  cmd.Parameters.Add(param1);
  17:  cmd.Parameters.Add(param2);


Summary



  • Don't trust the user's input.
  • Be strict about what represent valid input and reject everything else. RegEx are your friend!!!
  • Use parameterized queries not string concatenation.
  • Connect to the database server by using a least-privilege account, not the sysadmin account.

Code secure!!!!


Technorati Tags: , , ,

Wednesday, October 17, 2007

.NET Framework Multi Targeting in Visual Studio 2008

One of the great features in Visual Studio 2008 is the ".NET Framework Multi Targeting".  This allows you to build applications targeting any of these frameworks using Visual Studio 2008:

  • .NET Framework 2.0 - released with Visual Studio 2005
  • .NET Framework 3.0 - released with Windows Vista
  • .NET Framework 3.5 - will release with Visual Studio Orcas

After I built a project targeted .NET framework 2.0 I encountered problem on a machine with .NET framework 2.0 installed.

It turns out that when installing Visual Studio 2008, it also install .NET framework 2.0 SP1. Hence, this means that when you target .NET 2.0 in Visual Studio 2008, you are really targeting .NET 2.0 SP1.

To run applications which built with Visual Studio 2008 and targeted to .NET framework 2.0, be aware that you need NET framework 2.0 SP1 on the application's host.

Saturday, October 13, 2007

Gmail's Storage Increases to 6 GB

gmailI read at Google Operating System blog that Gmail will increase the free storage gradually in the next days. On October 23, you'll get 4321 MB of storage, then the growth will slow down until January 4, when you'll have 6283 MB of storage.

That's really great.

Read more here.

Technorati Tags: ,

Linq to XML - Adding,Updating and Deleting data

The previous post about Linq to XML introduced how to query XML data using LINQ. LINQ allows us to not only query XML in a truly unique way, but also create XML documents in a very expressive manner. This post will talk about other operations on the XML: adding, updating and deleting data.

First, lets create a sample XML document:

   1:  XElement book = new XElement("Books", new XElement("Book",
   2:      new XAttribute("publisher", "O'Reilly Media, Inc."),
   3:          new XAttribute("price", "40$"),
   4:          new XElement("title", "Learning WCF: A Hands-on Guide"),
   5:          new XElement("authors", new XElement("author", "Michele Bustamante"))));
   6:   
   7:  book.Save("Books.xml");

Adding data to the XML document


Adding XML to the existing XML document is very simple, we need only construct our XML using a mixture of XElement and XAttribute types (there are other ways also...) and then add them to the document.


The following adds a new book:


   1:  XElement doc = XElement.Load("Books.xml");
   2:  XElement newBook = new XElement("Book",
   3:      new XAttribute("publisher", "Microsoft Press"),
   4:      new XAttribute("price", "45$"),
   5:      new XElement("title", "Introducing Microsoft LINQ"),
   6:      new XElement("authors", new XElement("author", "Paolo Pialorsi"), 
   7:          new XElement("author", "Marco Russo")));
   8:   
   9:  doc.Add(newBook);
  10:  doc.Save("Books.xml");

We must save the xml with the save method, because in LINQ to XML, no changes are made to the loaded XML document until that document is saved.


The XML document now is:


   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <Books>
   3:    <Book publisher="O'Reilly Media, Inc." price="40$">
   4:      <title>Learning WCF: A Hands-on Guide</title>
   5:      <authors>
   6:        <author>Michele Bustamante</author>
   7:      </authors>
   8:    </Book>
   9:    <Book publisher="Microsoft Press" price="45$">
  10:      <title>Introducing Microsoft LINQ</title>
  11:      <authors>
  12:        <author>Paolo Pialorsi</author>
  13:        <author>Marco Russo</author>
  14:      </authors>
  15:    </Book>
  16:  </Books>

Updating data


Updating XML data is also very simple; Just pick the element/attribute you wish to update and then set its new value.


   1:  XElement doc = XElement.Load("Books.xml");
   2:   
   3:  //obtain a single book
   4:  IEnumerable<XElement> singleBook = (from b in doc.Elements(
   5:                                        "Book")
   6:                                      where ((string)b.Element(
   7:                                      "title")).Equals("Introducing Microsoft LINQ")
   8:                                      select b);
   9:   
  10:  //update book, should only be 1
  11:  foreach (XElement xe in singleBook)
  12:  {
  13:      xe.SetAttributeValue("price", "39$");
  14:      
  15:      //use the ReplaceContent method to do the replacement for all attribures
  16:      //this will remove all other attributes and save only the price attribute
  17:      xe.ReplaceAttributes(new XAttribute("price", "32$"));
  18:  }
  19:   
  20:  doc.Save("Books.xml");

Deleting data


We simply have to get the object we want to delete and then delete it using the Remove() method.


   1:  XElement doc = XElement.Load("Books.xml");
   2:   
   3:  //obtain the first Book
   4:  IEnumerable<XElement> firstBook = (from b in doc.Elements(
   5:                                        "Book")
   6:                                        select b).Take(1);
   7:   
   8:  //delete book price
   9:  foreach (XElement xe in firstBook)
  10:  {
  11:      xe.Attribute("price").Remove();
  12:  }
  13:   
  14:  doc.Save("Books.xml");

Other way: we pass a lambda expression in as an argument to the Where extension method.

As you can see, Xlinq is really simple and great way to work with XML.


Enjoy!


Wednesday, October 10, 2007

Create custom task for MSBuild - Step by Step

This is the 2nd post in the msbuild posts series. The first post was an introduction to MSBuild and give you tasting of the basics.

In order to extend Team Foundation Build by plugging in your own logic and tasks, you must write a custom task and use it in your build script (the .proj file).

Custom MSBuild task must be implemented as a .NET class that implements the ITask interface, which is defined in the Microsoft.Build.Framework.dll assembly. You can implement your task in the following two ways:

  1. Derive your class directly from ITask and implement the methods on this interface. or
  2. Derive your class from the helper class, Task (an abstract base class that is a default implementation for BuildEngine and HostObject properties) which is defined in the Microsoft.Build.Utilities.dll assembly. Choosing this option makes it easier to log events from your task.

In both cases you must implement (ITask) or override (Task) it's Execute method. I override this mwthod with a very simple logic to just log a string value to the Build log as you see below.

Step 1 - Creating project

Create Class Library project with a class and a reference to Microsoft.Build.Utilities assembly. I'll derive the class from the Task abstract class and override the Execute method.

Step 2 - Writing the task

Execute function must return true if task has executed successfully otherwise it must return false. Now I will add my code to the Execute method - this is my logic which I want to be executed during the build process. I also add a property to the class (Message) and set an attribute to it [Required] (line 29) - this indicates that msbuild must pass a parameter to the task. The Log ( line 17,24) object I use is the LoggingHelper of the Build Utilities (defined at Microsoft.Build.Utilities.dll )

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Text;
   4:  using Microsoft.Build.Utilities;
   5:  using Microsoft.Build.Framework;
   6:   
   7:  namespace MSBuildTasks
   8:  {
   9:      public class MyTask:Task
  10:      {
  11:          private string message;
  12:   
  13:          public override bool Execute()
  14:          {
  15:              try
  16:              {
  17:                  Log.LogMessage(
  18:                      String.Format("This is the message from my task: {0}",
  19:                      message));
  20:                  return true;
  21:              }
  22:              catch
  23:              {
  24:                  Log.LogError("Error occured in my task!");
  25:                  return false;
  26:              }
  27:          }
  28:   
  29:          [Required]
  30:          public string Message
  31:          {
  32:              get { return message; }
  33:              set { message = value; }
  34:          } 
  35:   
  36:      }
  37:  }

Now compile the project.


Step 3 - Registering the task in MSBuild file


Now we need to import and register this custom task to the MSBuild file we want to extend (This is because MSBuild must know how to locate the assembly that contains the task class.) . We'll do it by editing the .proj file of the build and add a <UsingTask> element which is a direct child of root <Project> element.  This element has a TaskName attribute to get the name of the task class and an AssemblyFile attribute to get the name or address of the assembly where this class is implemented in.

<UsingTask 
TaskName="MSBuildTasks.MyTask" AssemblyFile="C:\Work\Projects\Samples\MSBuild\MSBuildTasks\bin\Debug\MSBuildTasks.dll"/>

Step 4 - Calling the task from MSBuild


Calling the task depends on the point in the build process where we want to call. We should choose the point in the process that we want to call the task and add the following under it:


   1:  <Target Name="MyTaskTarget">
   2:      <MyTask Message="Hi MSBuild" />
   3:    </Target>

Line 2 calls the task. The message here is the required parameter to pass to the task.


Step 5 - Running the MSBuild file


After all of that you should run the msbuild file.


This is my MSBuild file (.proj extension)

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="MSBuildTasks.MyTask"
AssemblyFile="C:\MSBuildTasks\MSBuildTasks.dll" />
<Target Name="MyTaskTarget">
<MyTask Message = "Hi MsBuild"/>
</Target>
</Project>

This is the output of the example.


msbuild


Enjoy!!


See you in the next post of the MSBuild series.




Technorati Tags: