Entity Framework Examples – Visual Studio 2013 Update

Microsoft has a habit of making updates between versions of Visual Studio applications difficult. For example, the simple act of opening a solution (.SLN) file using a different version of Visual Studio than the one used to create it can be difficult or impossible. Most technology updates contain breaking changes that mean older code requires tweaks in order to continue working. Even the Visual Studio IDE interface changes, which means step-by-step instructions no longer work properly. Unfortunately, all of these sorts of changes have affected the examples in Microsoft ADO.NET Entity Framework Step by Step. This book is written to support:


  • Visual Studio 2012 Professional (or above)
  • Entity Framework 5.x

It doesn’t surprise me that Visual Studio 2013 developers are encountering problems with the book. Changes to the IDE mean that the step-by-step instructions won’t work as stated and there isn’t an easy method of fixing this problem short of rewriting the book. Likewise, changes to the Entity Framework mean that some assemblies such as System.Data.Entity don’t even exist any longer, so some book explanations won’t make sense.

However, it’s still possible to open the examples and see how they work. Instead of opening the .SLN file associated with an example, open the C# Project (.CSProj) file. For example, when looking at the example in Chapter 1, you open the SimpleEF.csproj file found in the \Microsoft Press\Entity Framework Development Step by Step\Chapter 01\SimpleEF\SimpleEF folder instead of the SimpleEF.sln file found in the \Microsoft Press\Entity Framework Development Step by Step\Chapter 01\SimpleEF folder when using Visual Studio 2013.

Much of the theoretical, usage, and general functionality information in the book (about half of the book) is still useful to the Visual Studio 2013 developer as well. So, there is still a lot of value to obtain by reading my book, but readers are right to point out that not every feature will work as written. Please accept my apologies in advance if you purchased the book and were disappointed with it. I did provide clear instructions about the products to use with the book in the book’s Introduction, but such information can be easy to miss.

As always, I try to provide every reader with a great reading experience. Should the publisher decide to update this book, you’ll learn about the update here when I start looking for beta readers. Please let me know about your other book-specific questions at John@JohnMuellerBooks.com.


The Entity Framework and Visual Studio 2012 Update 1

It’s common practice for me to wait a day or two and then look for potential problems with an update before I install it. I don’t have a fleet of machines with which to test updates and an errant update could put me out of business until I can correct it. I let Visual Studio 2012 Update 1 languish for a while because I’m in the midst of a book project with it (Entity Framework Development Step by Step) and wanted to wait until I reached a point where the update wouldn’t affect my scheduled writing time. A cursory look online didn’t point out any problems with the update. However, after installing Update 1 I suddenly began receiving this message every time I tried to perform an update of my Entity Framework model:

A processor named ‘T4VSHost’ could not be found for the directive named ‘CleanupBehavior’.

The odd thing is that I had tried a number of other tasks and completed them without problem with the update in place. So, this issue took me by surprise. Even more interesting is that there doesn’t seem to be a major outpouring of angst online about the issue—leading me to believe that many developers are only now moving to Visual Studio 2012. I did find a Microsoft Connect discussion about the issue, which includes feedback from Microsoft about the problem. This problem apparently first appeared as part of the Community Technical Preview (CTP) release. It appeared to be fixed during that release, so Microsoft closed the error. However, look down the list of comments and you see that on 3/5/2013 Microsoft reopened the issue.

The Microsoft Connect discussion also presents two workarounds—neither of which worked for me. I finally ended up uninstalling my copy of Visual Studio 2012 completely, ensuring that the directory and everything else associated with Visual Studio 2012 that I could find were removed from the system, and reinstalling Visual Studio 2012 sans Update 1 to get my system back into an operational state.

The bottom line is that I can’t recommend installing Update 1 if you plan to work with the Entity Framework using Visual Studio 2012. In fact, it may be a good idea if you hold off installing Update 1 until Microsoft has more time to work out the kinks. Don’t get me wrong. Installing updates is an important part of keeping your system running well and keeping the crackers at bay, but this is one time where the update fails to live up to its promise. Let me know whether you’ve experienced this particular issue at John@JohnMuellerBooks.com.


.NET Framework Version Error When Installing Visual Studio 2012

I received a few messages from readers recently asking about an error message they receive when trying to install the release version of Visual Studio 2012 on their Windows 8 system (I imagine that the same error will occur when installing on Windows Server 2012, but no one has contacted me about it). The error says that Visual Studio 2012 can’t install because the version of the .NET Framework 4.5 is wrong.

Unfortunately, the error message isn’t very helpful. You can’t install a new version of the .NET Framework 4.5 over the top of the existing installation. In addition, you can’t uninstall the old version and then install the new version because Windows 8 requires the .NET Framework 4.5 for certain operating system elements. In short, there isn’t any apparent way to fix the problem.

The issue will go away at some point because it originates as a conflict between the Windows 8 version and the Visual Studio 2012 requirements. Every reader who has had this problem is using a non-released version of Windows 8 (normally the RC version). You can’t install the release version of Visual Studio 2012 on a non-release version of Windows 8. I’m assuming that the same error occurs if you try to install a release version of Visual Studio 2012 on a non-release version of Windows Server 2012, but I’d like to hear if anyone has tried this out at John@JohnMuellerBooks.com.

What concerns me about this particular error is that it’s one time where Microsoft could have (and probably should have) come up with a substantially better error message or provided some sort of Knowledge Base article on the topic. As far as I know, there isn’t any such article and developers are currently having to rely on community support to fix this problem. It isn’t the first time Microsoft has left developers wondering. If you ever encounter this sort of problem, please let me know about it. If I can confirm the issue, I’ll put together a blog entry about it to get the word out to others in order to save them a bit of time.


Choosing the Right Express Edition Version

A lot of my readers rely on the Visual Studio Express Edition products to follow the examples in my book with good reason—the product is a free download. Books like Start Here! Learn Microsoft Visual C# 2010 Programming are actually designed from the ground up to use Visual Studio Express Edition. Even though I wrote Professional Windows 7 Development Guide with the purchased product in mind, most of the examples work just fine with the Express Edition as well. It makes sense to me that you’d want to try to learn as much as possible without making a huge commitment in software, so I welcome hearing about your Express Edition experiences.

The latest issue I’m encountering with readers is that Microsoft has changed how the Express Edition downloads work for Visual Studio 2012. There are now several versions of the Express Edition and you have to be sure you download the correct version to ensure that the IDE works with your operating system and my books. Make sure you download Express for Windows Desktop, not Express for Windows 8 (which doesn’t install on anything but Windows 8). The Express for Windows Desktop works with the following operating systems.


  • Windows 7 SP1 (x86 and x64)
  • Windows 8 (x86 and x64)
  • Windows Server 2008 R2 SP1 (x64)
  • Windows Server 2012 (x64)


This version of the Express Edition will let you create a number of application types. For example, you can create these sorts of applications:


  • Windows Presentation Foundation (WPF)
  • Windows Forms (WinForms)
  • Win32

Notice that there is no Metro support included with this version. None of my books currently support Metro either. However, if you decide you want to create a Metro application, then you need to download the Express for Windows 8 version and you must install it on a Windows 8 system to use it. Even though the downloads may look confusing, the differences between them are really straightforward.

Make sure you meet all of the requirements for install Visual Studio 2012 on your machine. The Express for Windows Desktop version has these requirements:


  • 1.6 GHz or faster processor
  • 1 GB of RAM (or 1.5 GB when running on a virtual machine)
  • 5 GB of available hard disk space
  • 100 MB of available hard disk space
  • 5400 RPM hard disk drive
  • DirectX 9-capable video card running at 1024 x 768 or higher display resolution

Don’t get the idea that my books require Visual Studio 2012. All of my existing books work just fine with the Visual Studio 2010 Express Edition. This version works on older versions of Windows and has smaller system requirements. Of course, Microsoft will remove this product from its site at some point, so if you want to use this older version, make sure you download it now.

Let me know if you encounter any additional difficulties using the Visual Studio 2012 Express for Windows Desktop with my books at John@JohnMuellerBooks.com. In the meantime, happy coding!


Updates in the .NET Framework 4.5

I try hard to follow the latest developments in all of the technologies that interest me. Since my range of interests is large, sometimes it proves nearly impossible to track it all. So, like you, I rely on summaries of information at times. I’ve been working with Visual Studio 2012 quite a lot lately. Not only is it the tool of choice for other authors and the tool I’ll use to write books myself, but I also need to verify that the source code for my currently supported books still works. The new features in the associated .NET Framework 4.5 are of great interest to me, so I checked out an article about it entitled, “What’s New in the .NET 4.5 Base Class Library” by Immo Landwerth.

There are a lot of welcome updates. For example, asynchronous programming won’t be as difficult in the future because Microsoft has taken measures to simplify things. You can read the article yourself to see how much better the new technique is. I’m sure that many developers will welcome the change because it will make it possible for developers to create asynchronous routines with greater ease, which should make applications considerably more responsive. Given that one of the five tenets of Metro programming is to be fast and fluid, it doesn’t surprise me that .NET 4.5 contains this sort of change. I worked through the example and even tried a few of my own and the new asynchronous support works great! However, I have to wonder what the cost of this new support is. It isn’t often that you get simplicity without the loss of flexibility. As I explore this new feature, I’ll let you know if I do come up with reasons to use the old approach (as nice as the new approach is).

The new ZIP file support strikes me as something Microsoft added because everyone else already has it. Microsoft was late to the party with this one. However, the new support is quite welcome because ZIP files have proven to be a problem in the past. Not many applications can get by without this particular archive today. What I had hoped would happen is that Microsoft would build an extensible archive support feature that would support ZIP files, but would also make it incredibly easy to add support for other archive file types, such as JAR and TAR. Unfortunately, it looks like we’ll see one new archive file format supported at a time.

I’ll need to play with the read-only collections to determine how I’ll use them. Right now, it appears that this new feature will see limited use in my applications (if I use it at all). The first two improvements mentioned in this post have a definite use in my applications and I’m welcoming them with open arms. What I’d like to hear from you is how you’d use this new feature. Let me know what you think about it at John@JohnMuellerBooks.com.

Articles are problematic at times because the author often doesn’t have sufficient space to cover all of the details. I know that I’ve encountered this issue myself. The editor assigning the article might not have sufficient grasp of the material to make a good decision about it either. I wish that this article had been split into several parts because the author lists a number of miscellaneous improvements at the end of the article. If you read the article, make sure you check this list carefully because some of the improvements, such as Console.IsInputRedirected, Console.IsOutputRedirected, and Console.IsErrorRedirected properties, are quite interesting. I write a lot of console applications and utility application that provide a console interface. Having these properties available will make it possible for me to code applications that are more responsive to user needs.

I’ve noticed that Microsoft didn’t provide a full number update to the revision number in this case and the minor upgrade number is warranted. There are some nice changes to the .NET Framework 4.5, but nothing so exciting that you should rush out right now and start implementing it in your applications. It would be wise to carefully add this update to your applications to determine when it provides a true advantage and when there is potentially a loss of functionality or flexibility that makes the update a bad idea.