Silverlight and Visual Studio

You may be puzzled sometime by a dialog box that Visual Studio displays about Silverlight. The dialog box comes in a number of forms, but basically it tells you that you need an updated version of Silverlight on your system. The dialog box also provides an URL where you can go to download the latest version. Because you can’t open your Silverlight project until you get the latest version of Silverlight (despite the fact that you opened it just yesterday without any trouble), you dutifully click the link and download the latest version of Silverlight. The file is likely named Silverlight_Developer.exe or something similar.

After the download is complete, you double click the file and begin the installation. However, the installation program tells you that you do indeed have the most recent version of Silverlight installed on your machine. Closing your project and reopening it produces the same error message. Of course, this is just the sort of frustrating problem that drives everyone (including developers) crazy.

The problem is that you do indeed have the latest version of Silverlight installed, but it’s the standard version, not the developer version. At some point, you likely performed an update of your Silverlight installation through your browser. The browser will always download the standard version because that’s all it needs. Visual Studio, on the other hand, requires the developer version.

Unfortunately, short of inspecting the files closely, nothing tells you about these two versions. When you look at the entry in the Programs and Features window, all you see is Microsoft Silverlight. There is nothing to tell you which version you have installed.

To fix this problem, uninstall the standard version of Microsoft Silverlight. Don’t uninstall the Microsoft Silverlight SDK entries. Now, double click the Silverlight_Developer.exe file again and the installation will run just fine. Close and reopen your project and you’ll find that it too works just as it should. If you have a browser open, make sure you close and reopen the browser as well or you’ll experience problems debugging your application.

It would be nice if Microsoft had provided a better entry in the Programs and Features window. Better yet, it could have provided a better error message when you opened your project. Lacking these helps means that you must discover just how to fix the problem on your own. Let me know if you encounter any other odd Visual Studio behaviors of this sort at


An End of Support for Moonlight, the Silverlight Alternative

I’ve promoted using the Mono, open source alternative to the .NET Framework, for more than a little while now. Mono makes it possible to use .NET applications in environments where you might not otherwise be able to run them. I commonly use Mono with my Linux setup. However, it may interest you to know that I’ve also used it with Windows 2008 Server Core. In fact, I wrote one of several articles on the topic for DevSource. Some of my books, such as Administering Windows Server 2008 Server Core, rely on Mono as a means for accomplishing tasks that would be difficult otherwise. Moonlight, is the Silverlight equivalent of Mono. It lets you run .NET Web applications on other platforms. Unfortunately, Xamarin, the folks who support Mono, have chosen not to continue supporting Moonlight.

Actually, there is some confusion about precisely who does provide support Moonlight. It seems that even though you download Moonlight from the Mono site, Xamarin never took official possession of the product. Until now, Novell has been providing the updates for Moonlight and the last update was quite some time ago. I just checked and you can still download Moonlight. I would imagine that the Moonlight download will remain accessible for the foreseeable future, so any ASP.NET applications you’ve created will continue to run on your Linux system. The major problems seem to be in the updates that Microsoft has added to Silverlight and that Silverlight has never gained the sort of traction that Xamarin hoped it would as a desktop application platform.

Mono is actually a versatile framework. It runs on openSUSE, Max OS X, Windows, Solaris, and other (including Debian and Ubuntu) platforms. All you need to do is download the version needed for your system. I’ve tested a number of my applications on Mono for both C# Design and Development and Start Here! Learn Microsoft Visual C# 2010 Programming. Command line applications almost always work, while some graphics applications will have problems (but even they run a majority of the time). The key is whether the application adheres strictly to the conventions for working with the .NET Framework, doesn’t use any special libraries, and doesn’t rely on P/Invoke. In short, your well-behaved application will generally work on Mono.

Moonlight provides similar functionality for Linux systems. I had always hoped that it would enjoy the same level of support as Mono does at some point, but it just never gained the required level of usage. Even if you can’t use Moonlight in it’s current form for your applications, it would be a good idea to consider at least trying Mono. You may find that the .NET application you thought would only run on Windows systems, runs just fine on all of the other platforms that I just mentioned. If you have any questions about Moonlight or Mono, let me know at I’ll do my best to answer them or find a source of information for you.

I’d also love to hear about your Mono and Moonlight usage experiences. It would be especially interesting to know whether you’ve used either product in a production environment and about any issues you encountered using them. The ability to expand your .NET applications beyond Windows is a reality despite what you may have heard to the contrary.


The Release of Start Here! Learn Microsoft Visual C# 2010 Programming

It’s always exciting to see a new book released. I had previously told you about my new book, “Start Here! Learn Microsoft Visual C# 2010 Programming” in my post entitled, “New Book Announcement: Start Here! Learn Microsoft Visual C# 2010 Programming.” That post provides some basic information about the book, including a list of the chapters and what you should expect as content. Today this book is finally in print, so you can see it for yourself. Interestingly enough, I’ve already received a few queries about this book. I’ll answer the most commonly asked question in this post, which is what prompted me to write it.

Every time I receive an e-mail, see a review of one of my books online, or obtain information about a book in some other way, I try to see if I can use the feedback to improve later editions or to write a better book. In fact, I maintain statistics about each of my books because I really value your input and want to make the best use of it. The statistics I obtain from all of these forms of input help me understand how you use books better.

One of the comments I receive fairly often is that most books feel like college courses. They’re highly structured and seem most interested in teaching how to write applications using a stilted, old fashioned approach that doesn’t fit the reader’s needs very well. At least one reader has associated this approach with learning how to play piano using textbooks—you spend hours performing boring exercises to learn how to play something relatively simple. In the reader’s words, “Such an approach sucks every bit of joy out of the process of learning to play piano.” Yes, many people do learn to play piano using textbooks, but others learn to “play by ear” (simply by doing it without learning any basics first). These readers wonder why computer books can’t be written in a way that let’s you learn how to program using the “play by ear” approach.

I agree that not everyone learns in the same way. All other things being equal, one person may require a completely different book from someone else in order to get anything out of it because the two people learn differently. So, even if I wrote the most error free and comprehensive book ever written about C# application development, some people would love it and others would hate it simply because of the approach I took. Trying to solve this problem of writing a book that uses the “play by ear” approach has proven difficult.

To solve this problem, I needed to come up with a technique that would allow the reader to write code and then “hear” what the code does by running it. However, simply seeing the output isn’t sufficient in this case. In order to understand the code, the reader has to trace through itessentially “hearing” the individual tasks performed by each line of code. I tried a tracing technique for the first time in LINQ for Dummies and received quite a few positive responses about it. Now, LINQ for Dummies does use the college approach for the most part, but some sections use this new “play by ear” approach and it seems to work well for readers who require that approach.

It was with great excitement then, that I took on a book that would approach C# development from a completely different perspective after Russell Jones asked me about it. Start Here! Learn Microsoft Visual C# 2010 Programming is the result of my efforts. This book uses the tracing technique I started to develop in LINQ for Dummies extensively. Instead of spending hours learning about basic programming constructs and then writing tiny programs to put the theory into practice, you begin writing code immediately.

The main plus I see in using this approach is that nearly anyone should be able to learn to write useful (but basic) applications in a fraction of the time normally required and without devoting nearly as much time to the activity. The learning process should also be significantly less boring because you’re always doing something that has real world results. Of course, I’m extremely interested in seeing how this approach works for you, the reader. The only way I’ll get that information is if you write me at and tell me what you think of the book.

New Book Announcement: Start Here! Learn Microsoft Visual C# 2010 Programming

Have you ever attended a college course and found that you just didn’t understand what the teacher was trying to say? Worse yet, you found yourself dosing during a lecture? Many people require a hands-on approach to learning—they just don’t learn well using the college approach. Start Here! Learn Microsoft Visual C# 2010 Programming is designed to answer needs of anyone who has quickly become disenchanted with the way that colleges teach programming. You’ll start coding in Chapter 1 and won’t stop coding until you’ve completed the book!

Start Here! Learn Microsoft Visual C# 2010 Programming takes an entirely new approach to learning how to write code. You begin by writing some codeimagine that! Then, you use a special tracing technique to see how the code workswhat it does and how it does it. Instead of mind numbing sessions involving the discussion of keywords from a purely theoretical view, you jump right into using those keywords to do something useful.

You also don’t waste your time with silly Hello World applications. You get right into techniques that will prove useful later when you’re creating applications on your own. Chapter 1 starts things off right by showing you how to display an image from a Web site on the local desktop. Instead of spending hours trying to figure out looping mechanisms, you use the modern techniques provided by Language INtegrated Query (LINQ) to achieve your goals. You’ll do things like access a Web service and request weather information from it. There are even Silverlight and Windows Presentation Foundation (WPF) examples. Here is a quick overview of the book’s content:

  • Chapter 1: Getting to Know C#
  • Chapter 2: Developing a Web Project
  • Chapter 3: Using Simple Data Manipulation Techniques
  • Chapter 4: Using Collections to Store Data
  • Chapter 5: Working with XML
  • Chapter 6: Accessing a Web Service
  • Chapter 7: Using the Windows Presentation Foundation
  • Chapter 8: Working with Libraries
  • Chapter 9: Creating Utility Applications
  • Chapter 10: Using LINQ in Web Applications
  • Chapter 11: Working with Silverlight Applications
  • Chapter 12: Debugging Applications

You’ll also gain knowledge that many people spend years learning. For example, the tracing technique you use throughout the book naturally leads into the debugging information in Chapter 12. Debugging won’t be a mystery to youit’ll actually be a natural part of your work process so you’ll find it much easier to locate the bugs in your applications.

There is even a chapter on writing command line utilities. More and more administrators are returning to the command line because the GUI is simply too slow in today’s competitive world. Unfortunately, many developers don’t know how to write a really good command line utility, but you’ll gain this skill at the outset.

This book (my 88th) is truly designed for the complete novice. You do need to know how to work with Windows and perform basic tasks such as installing applications. However, you don’t need to know anything about coding to start using this book. In fact, people who already have a good starting knowledge of programming may find that some of the material is a little too simple. If you have any questions at all about my new book, please let me know at

Using the PTVS for a Silverlight Project

My book, “Professional IronPython” doesn’t discuss how to work with technologies such as Silverlight, so I thought I’d see how hard it would be given that PTVS comes with support for a Silverlight project. This post adds to my previous post about PTVS. Of course, you’ll need to have PTVS installed on your system before you begin working with this example.

To begin this example, you start Visual Studio as normal and choose File | New to create a new project. The New Project dialog box should contain an entry for an IronPython Silverlight Web Page template as shown here. If you don’t see this template, then you probably don’t have IronPython 2.7 installed on your system and can use the instructions found in the IronPython 2.7 and PTVS blog entry to install it.


Give your application a name (the example uses the default of SilverlightPage1) and click OK. You’ll see a new project appear like the one shown here:


What I find interesting is that there is a designer provided for this template, but none provided for the Windows Forms application. I tried the Designer out and it works well. There isn’t any difference in creating a Silverlight application using this template than any other language I’ve tried. However, the list of controls you can access is limited. Here’s what the default Toolbox entries look like:


I tried adding a control to the list, just to see what would happen. When you open the Choose Toolbox Items dialog box, you’ll see that all of the normal controls are already selectedthey simply don’t appear in the Toolbox. I even tried checking a few controls on the Silverlight-specific tab without any result. So, my thought is that you’re limited to the controls show. If you know otherwise, please contact me at Even so, you can create a business application without any problem using the controls provided.

The Silverlight front end for your project uses HTML-like statements, as you might expect. You create linkage between the Web page and your IronPython code behind just as you would any other language. Here’s what the default sample code looks like:

<script type="text/python" src=""></script>

The code behind looks just like any other IronPython code you might have created in the past. Here’s the default example code:

def SayHello(s,e):
    window.Alert("Hello, World!") += SayHello

In short, you don’t have to worry about any odd programming techniques to make this example work. I was frankly surprised at just how nicely things do work with this template. There are a few oddities you’ll encounter. The first is that when you press F5 to start debugging your application, the IDE starts the Chiron development server, rather than the default. That’s not too odd, but it’s something you should know about.

The second is that the application doesn’t automatically appear in your browser. So, you’re waiting for something to happen and nothing does. Instead, you must right click the server entry in the Notification Area and choose Open in Web Browser from the context menu. At this point, I received a directory listing like the one shown here, rather than the application I expected.


Clicking SilverlightPage1.html did display the application. In fact, it displayed a lot more. I also received an IronPython Console I could use for debugging tasks, as shown here:


As shown in the figure, you can minimize the IronPython Console when not needed, so you can see your application better. Overall, I was very impressed with the Silverlight template offering and think it’s a great addition to the IronPython developer’s toolbox. Be sure to look for additional PTVS entries in my blog as time permits and to let me know your thoughts about it!