- | rssFeed | My book on MSBuild and Team Build | Archives and Categories Thursday, April 23, 2009

ASP.NET MVC: Using Entity Objects in Views

If you are you using ASP.NET MVC and the Entity Framework then odds are that you will want to use some of your entity object inside of your views. If you've tried this you may have run into the following exception: "CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)".


So the first guess is to add a reference to System.Data.Entity assembly in the MVC project. I did that then ran my app again, and I encountered the same error. After some poking around I figured out that you need to manually add the assembly to the web.config file. So in your web.config file you need to add the element

<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Under the compiliation\assembiles node, here it is:

Once you've done this you should be able to run your app with no problems.

 

Sayed Ibrahim Hashimi

ASP.NET MVC | Entity Framework Thursday, April 23, 2009 7:18:20 PM (GMT Daylight Time, UTC+01:00)  #     | 
Saturday, April 11, 2009

Inside the Microsoft Build Engine: Table of Contents

After my previous entry a reader requested that I post a table of contents for my book Inside the Microsoft Build Engine. After searching I realized that I didn't have one. So I put one together here it is.

Contents at a Glance

Part I Overview

  1. MSBuild Quick Start
  2. MSBuild Deep Dive, Part 1
  3. MSBuild Deep Dive, Part 2

Part II Customizing MSBuild

  1. Custom Tasks
  2. Custom Loggers

Part III Advanced MSBuild Topics

  1. Batching and Incremental Building
  2. External Tools

Part IV MSBuild Cookbook

  1. Practical Applications, Part 1
  2. Practical Applications, Part 2

Part V Team Foundation Build

  1. Team Build Quick Start
  2. Team Build Deep Dive
  3. Team Build Cookbook

Appendixes

 

Sayed Ibrahim Hashimi

msbuild | book Saturday, April 11, 2009 4:55:18 PM (GMT Daylight Time, UTC+01:00)  #     | 
Thursday, April 09, 2009

Inside the Microsoft Build Engine: The Praise Continues

Since the release of Inside the Microsoft Build Engine, the book that I wrote along with William Bartholomew, there has been a continuous stream of positive feedback posted. I would like to thank everyone that has taken the time to post reviews of the book. I think it is important that feedback is provided (positive or negative) so that potential readers can more accurately decide whether or not to purchase a particular book. I would like to highlight some of the reviews that I have found here.

Steve St. Jean, who is himself regarded as an MSBuild expert, posted a very thorough review of the book on his blog. I personally have never seen a book review by an independent party with soo much detail. Thanks Steve! Here is some of his comments.

"Wow! This is the book that I wish I had written. Sayed and William have covered the topic's depth and breadth with enough illustrations and code examples to make any developer productive with MSBuild and Team Build. No Experience Required."
"The "Deep Dive – Part 2" builds on the prior chapter to go deeper into Dynamic Properties and Items. One of the best nuggets of the book can be found here. On pages 60 & 61 they show the "MSBuild Order of Evaluation" which is essential to all but the most trivial MSBuild script. Up until this point I knew the basics of the evaluation order but had never been able to find a definitive order. This was the first time I knew that there was much I didn't know but sadly not the last."
"Batching is a process whereby MSBuild looks at an Item list and groups its elements based on some metadata attribute's values."
[Discussing Team Build Content]: "The "Deep Dive" section is truly "deep". It describes the default build process and then shows how you can customize the defaults to bring in your project's specific steps. Need to customize the Clean process? It's in there. Want to package your website into a Zip file? No problem. All the overridable "hook" Targets that Microsoft left in the process are described along with those Targets that you shouldn't touch."

Wes MacDonald who is a Team Systems MVP has these comments.

"This book was fantastic, full of great examples and guides you through customizing MSBuild and Team Build. I was initially surprised to find so many chapters dedicated to MSBuild but afterwards I realized there is just so much you can do with it, there probably could have been more."

Doug Holland who is a Visual C# MVP who works for Intel wrote on his blog:

"I have got to say this book totally rocks and I'll be looking for a second edition once VS2010 RTM is released."

Peter Blomqvist writes a blog post titled "Finally a proper book about MSBuild and Team Build"

"The book is well structured and is down to earth with a lot of practical examples from real world scenarios. I truely wish that I would have had access to this book back in 2005 when I started out with build automation in Team System."
"The book is a must read for anyone considering working with build automation using Team System (atleast until VSTS 2010 comes out and changes it again)."

Mathias Olausson has these comments on his blog.

"The book covers MSBuild and Team Build first with the basics and then with deep-dives that cover topics that are hard to find in one place."

 

Amazon.com

Reviews

 

Currently on Amazon.com we have 5 reviews and all 5 are rated 5 stars, and I didn't solicit any of them! Here are snippets from those reviews:

Highly Impressed

"This is a well written book on the MSBuild system. I was working on an open source project that will generate the MSBuild scripts and wanted to understand it well enough to take maximum advantage of it.

This book is all that I was waiting for, it is worth the price. The explanations are simply and very clear - easy to understand language."

A "must have" for any budding build master

"Even though I have decent experience in MSBuild I read this book from front to back twice over and was exceptionally impressed with how this book was put together."
"There is some fantastic advice and guidance for customizing MSBuilds, batch building and incremental building and there are 3 chapters dedicated to Team Foundation Build which were highly educational for me in not only a gathering a better understanding of the build process in Team Foundation but also a stronger understanding of how to utilize Build Agents, retention policies, triggers, and unit testing within Team Foundation Build."

The Definitive Companion on MSBuild and Team Build 2008

"This book's focus on making sure that MSBuild is explained to the tiniest details is a big win. The explanation and coverage of MSBuild is something you will not find in any other book (or even MSDN)."
"This is the definitive guide on Team Build 2008. I was particularly impressed with the Team Build Cookbook chapter, especially the load balancing discussion of the tool that William wrote"

Best book on the subject, hands down

"This book is outstanding."
"I highly recommend this book to anyone who is both new or experienced with MSBuild or Team Build. Great work!"

The book that everyone who does builds with Visual Studio needs

"I picked up this book because even though I knew how to use MSBuild and TFS Build I did not know all of the nitty gritty pieces of the underlying engine and all of the available options. I know them now."
"Having said that, if you are new to MSBuild then this is a great book. It very quickly introduces you to the basics of MSBuild (which you all use anyway if you use Visual Studio 2005 or greater) and how to quickly customize MSBuild to suit your needs."


Sayed Ibrahim Hashimi

msbuild Thursday, April 09, 2009 4:44:55 AM (GMT Daylight Time, UTC+01:00)  #     | 
Wednesday, April 01, 2009

Microsoft MVP

Earlier today I was awarded the status of Microsoft MVP! The area that they have put me in is Visual C#, you can see my profile at https://mvp.support.microsoft.com/profile/Sayed.Ibrahim.Hashimi.

I know that a lot of different people have nominated me for this award, and I am very grateful for that. I would especially like to thank Joe Healy. Joe has been pushing the MVP guys to accept me for quite some time. Now that I have received the award I just have to make sure that I keep it!

Sayed Ibrahim Hashimi
Visual C# MVP!

Personal Wednesday, April 01, 2009 9:38:30 PM (GMT Daylight Time, UTC+01:00)  #     | 
Wednesday, March 11, 2009

Congratulations, you've installed dasBlog with Web Deploy!

After logging in, be sure to visit all the options under Configuration in the Admin Menu Bar above. There are 26 themes to choose from, and you can also create your own.

 

dasBlog Wednesday, March 11, 2009 7:00:00 AM (GMT Standard Time, UTC+00:00)  #     | 
Wednesday, February 04, 2009

Comments about reusable MSBuild files

A reader of this blog asked me to review some reusable MSBuild file that he created. I won't reveal the details of his files here but here are my comments which are relevant to all reusable MSBuild files.

Properties in targets files

For targets file (MSBuild files designed to be imported by other files) if possible you should always define properties using conditions to ensure that the consumer hasn't alredy defined that value. See my new article MSBuild Best Practices (http://msdn.microsoft.com/en-us/magazine/dd419659.aspx) specifically the section titled "Defining Dynamic Items and Properties".

Assumptions in targets files

Your ProjectOutputHelper.targets file overrides the BuildDependsOn property. This is good and I am sure that it works great, but I don't agree 100% with this approach. You are assuming that the consumers of the file will be importing the Microsoft.Common.targets file which is most likely true, but in my opinion is a bad practice. Better would be to allow consumers of the file to extend the BuildDependsOn. See my new book Inside the Microsoft Build Engine in Chapter 7 you will find a section ‘Creating Reusable Build Elements’ which define some rules for targets files, this is explained more there.

Extendable targets should declare dependencies in a property

All non-internal targets contained inside of targets files should declare the target dependencies inside of a property. This allows consumers to inject steps into specific areas of the build process. For instance from Microsoft.Common.targets:

<PropertyGroup>

    <BuildDependsOn>

        BeforeBuild;

        CoreBuild;

        AfterBuild

    </BuildDependsOn>

</PropertyGroup>

<Target

    Name="Build"

    Condition=" '$(_InvalidConfigurationWarning)' != 'true' "

    DependsOnTargets="$(BuildDependsOn)"

    Outputs="$(TargetPath)"/>

Design incremental targets

If possible you should design your targets to build incrementally ( Chapter 6 of my book explains this) so that the targets that are already up-to-date don’t have to be rebuilt. It is good to get into the habit of creating targets that build incrementally.

Use MSBuild 3.5 Syntax

If you are building with MSBuild 3.5 (.NET 3.5) you should use the new ItemGroup and PropertyGroup elements inside of the targets instead of the CreateProperty and CreateItem task.

msbuild | Visual Studio 2008 Wednesday, February 04, 2009 5:06:59 AM (GMT Standard Time, UTC+00:00)  #     | 
Monday, February 02, 2009

Microsoft Press Blog Posting

The The Microsoft Press team has posted a blog about my book & upcoming articles, you can read it at All Sayed all the time (and MSBuild). These guys make it seem like I'm actually doing something, when in reality I've been on vacation for the past 5 weeks!

Sayed Ibrahim Hashimi

msbuild | Visual Studio 2008 Monday, February 02, 2009 4:17:35 AM (GMT Standard Time, UTC+00:00)  #     | 
Friday, January 30, 2009

Speaking at South Florida .NET Code Camp

I will be speaking on MSBuild at the South Florida .NET Code Camp on Saturday Feb 7. If you are in the area and interested in MSBuild then come and check me out!

Sayed Ibrahim Hashimi

msbuild | Presentations Friday, January 30, 2009 8:10:43 PM (GMT Standard Time, UTC+00:00)  #     | 
Saturday, January 17, 2009

Inside the Microsoft Build Engine: Published and In stock!

My new book Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build has been published and is now in stock at amazon.com. This book contains 12 chapters, 9 of which are dedicated to MSBuild and the remaining three are Team Build. Two of the MSBuild chapters are dedicated to examples in a cook book fashion, there is one such chapter for the Team Build. This book is the only book that contains this type of coverage of MSBuild. From the begining of the book the MSBuild team was involved, they reviewed every MSBuild chapter and provided invaluable insight. Here is the table of contents for the book:
Chapter 1 : MSBuild Quick Start
Chapter 2 : MSBuild Deep Dive, Part 1
Chapter 3 : MSBuild Deep Dive, Part 2
Chapter 4 : Custom Tasks
Chapter 5 : Custom Loggers
Chapter 6 : Batching and Incremental Builds
Chapter 7 : External Tools
Chapter 8 : Practical Applications, Part 1
Chapter 9 : Practical Applications, Part 2
Chapter 10 : Team Build Quick Start
Chapter 11 : Team Build Deep Dive
Chapter 12 : Team Build Cookbook
App A : New Features in M Build 3.5
App B : MSBuild Common Properties and Items
App C : New Features in Visual Studio Team System 2010 Team Build

If you are interested in learning MSBuild from scratch, or looking to become a MSBuild expert then this book will help you. If you do get a copy please post a review on amazon.com.

Sayed Ibrahim Hashimi
msbuild | Team Build Saturday, January 17, 2009 4:05:26 AM (GMT Standard Time, UTC+00:00)  #     | 
Tuesday, December 09, 2008

My MSBuild Video on Channel 9

This past weekend I gave a presentation on MSBuild at the Tampa Code Camp, which I'm glad to say went very well. Besides that I met Brian Johnson from Microsoft. He shot a video of me discussion using MSBuild and Web Deployment Projects to automate deployment of Web Projects. You can see the video at http://channel9.msdn.com/posts/brianjo/Sayed-Hashimi-on-MS-Build/

Let me know what you think, I'm pretty excited because this is my first Channel 9 video.

The sample demonstrated here was inspired by some content that can be found in my new book Inside the Microsoft Build Engine. The book will be published the beginning of January, please buy several copies! I will post more detailed information about the book soon, but we have completed working on it.


Sayed Ibrahim Hashimi

msbuild | Channel9 | Video Tuesday, December 09, 2008 5:09:44 AM (GMT Standard Time, UTC+00:00)  #     |