This blog attempts to be a collection of how-to examples in the Microsoft software stack - things that may take forever to find out, especially for the beginner. I see it as my way to return something to the Microsoft community in exchange for what I learned from it.

28 December 2010

Almost everyone who has programmed something in C# has created an enum at one point or another:

public enum Whatever
{
Zero,
One,
Two,
Three
}

You can cast an enum value to an int - you then get a value assigned by the compiler based upon the order in the enum, so Zero will be 0, One will be 1, etc. If you have a particular sick mind you can add a new chapter to How to write unmaintainable code by creating something like

public enum Whatever
{
One = 5,
Two = 3,
Three = 2
}

But you can also assign values to it using characters. This way, I have created an enumeration that can be used to retrieve tiles from Google servers based upon their enum value without the switch I wrote in my infamous "Google Maps for Windows Phone 7" article. So now you can define the server on which Google stores a particular tile type like this:

09 December 2010

And now for something completely different – a review of someoneelse’s examples. I have been reading “WiX- A Developer's Guide to Windows Installer XML“ by Nick Ramirez. I would not dare call myself a WiX expert – in fact I wrote one three-component setup in the cause of a few weeks, but I was asked to review this book by its publisher, Packt Publisher and well, here’s my verdict.

Examples examples examples

What I like about the book: it takes you by the hand using what I think is the most powerful tool in teaching: examples. Which is what I so painfully missed when I myself was struggling with WiX. Lots of concepts and half-*ssed postings on forums, but no complete examples. In the first chapter the author starts a small example which gets more and more elaborate. After reading that first chapter you have a good idea of the most important concepts of installing. The second chapter follows the same recipe and gives you more of the fine details on creating files and directories. If you have read the first two chapters, you can write a basic installer.

Pick and choose

The rest of the book is more of the pick-and-choose type. It still follows the same recipe, but whereas the first two chapters are mandatory, the rest is optional – use what you need, although I would recommend not skipping chapter 5, “Understanding the Installation Sequence”

What do I miss?

I was puzzled by the absence of a description of the util:XmlFile task, which can be utilized for modifying config files during install. Apart from that, the sub titles says “Create a hassle-free installer for your Windows software using WiX”. That’s exactly what it delivers. I would very much have liked something on how you create and install web sites, handle the intricacies of creating applications pools, set the ASP.NET version, permissions, create CGI support settings and stuff like that – taking into account people can install on different operating systems and different versions of IIS. Maybe something for a second print? ;-)

Conclusion

First part learns you the basics pretty well, the rest is a solid reference. A book I should have bought and read before I started mucking around with WiX.

Feedback, comments and tokens of appreciation

If you spot things that are incorrect, or if you don't understand what I mean, please drop a comment on the offending article and I will help you ASAP. You can e-mail me at joostvanschaik at outlook dot com or contact me via twitter.

If you find the information on this blog useful (and apparently some 600+ people per day do on average) please let me know as well, that encourages me to keep doing this. Or do tell others - that made me an MVP; who knows what more it might bring ;-P

Disclaimer and legal stuff

Although I take great care in providing quality samples, all postings, articles and/or files on this site are provided "AS IS" with no warranties, and confer no rights. The views expressed on this blog are strictly my own and do not necessarily reflect the views of my employer, or anyone else on the planet for that matter.

I usually make original content, sometimes building upon other people's work. Sometimes I explain things that can be found elsewhere because I felt what I read was not clear enough for my limited mind so I explain it the way it finally clicked with me. In all cases I take great pains to be sure to link to people or articles who deserve the credit. If you think I have shortchanged you on the credits please let me know.

Please note, I do not work for Microsoft and while I proudly wear the title of "Microsoft Most Valueable Professional", my opinions, files offered, etc. do not represent, are approved of, endorsed by or paid for by Microsoft. The only power behind it is me and my sometimes runaway passion for parts of Microsoft's technology.