Generating Auto-Incremented Version numbers with PowerShell

The code snippet below is something I had to write to simplify some build & deployment. Instead of me having to remember the latest version number to use, this PowerShell snippet lets me store the current version number as a Major.Minor.Patch (for example 1.2.3) one-line text file. The script updates the version number every time it is run.

Some techniques demonstrated:

  • Simple reading and writing of strings with Text files
  • Converting Strings to Integers and back
  • Splitting a string


Write-Host Calculate new version number

$curverfilename= "d:\curver.txt"

$curver = Get-Content $curverfilename | Out-String

Write-Host Current Version $curver

$tokens = $curver.Split(".")

$major = [int]( $tokens[0])

$minor = [int]( $tokens[1])

$patch = [int]( $tokens[2])

$new_patch = $patch + 1

$Version = ([string] $major)+"."+ ([string] $minor ) +"." + ([string]$new_patch)

Write-Host $Version

$Version | Out-File $curverfilename


Interlude: Swan Lake through Zeno Music Visualizer

Let’s start 2014 with something inspiring.

Swan Lake - Zeno Music Visualiser from Glenn Marshall on Vimeo.


On the future of MetaWeblogSharp

There is a good change coming.

MetaWeblogSharp is merging into the MetaWeblog.Portable project (

Benefits for You

  • The code will see more active development and will as a result be more reliable with different MetaWeblog services.
  • The “Portable” part means that you’ll be able to use the code on .NET Framework 4.5, Windows 8, Windows 8 RT, Windows Phone 8, iOS, and Android! MetaWeblogSharp only ever supported Windows 8. As a developer who wants people to use his code – this naturally makes me very happy.
  • It will have great support for asynchronous operations – MetaWeblogSharp only supported synchronous use
  • It doesn’t fracture the codebase and in turn benefits the greatest number of developers.

Key Points

  • I realize a few of you are still using MetaWeblogSharp. The project will not suddenly disappear right now. I’ll keep the project on CodePlex and the binaries on NuGet for at least the next six months
  • MetaWeblogSharp is now in maintenance mode. If you find an bug or have a question feel free to contact me. I’ll make selected bugfixes into MetaWeblogSharp and port them into MetaWeblog.Portable.
  • If you have a new feature request, likely this will go directly MetaWeblog.Portable. (Though I would consider adding it to MetaWeblogSharp if it is incredibly important)

Next Steps

  • Currently, I’m working on the MetaWeblog.Portable project on GitHub. My current focus is to make general compatibility improvements and more important add a framework for testing the MetaWeblog.Portable client.
  • As part enabling unit testing, I’m building a very simple MetaWeblog Server component – a simple HTTP server that implements a xml/filesystem based blogging system. A side-benefit of this simple MetaWeblog-based blogging client is that if you ever want to build your own toy web server or XmlRPC server or MetaWeblog server you will have a modern, clean example of how to do it.


Thanks for everyone who has used MetaWeblogSharp and remember with this change you’ll get more features – not less.


O’Brien Describes The Future (from Orwell’s 1984)


It’s almost unfortunate that in 2013 due to news involving the NSA that there has been a renewed interest in George Orwell’s 1984. I say unfortunate because the lost in the politics and debates about national security, is the skill of Orwell as an writer.

More than twenty years have elapsed since I first read 1984 and this time it experienced it as an audio book (Link to 1984: New Classic Edition from Audible) fantastically narrated by Simon Prebble.

One section in particular was brilliantly written and performed – a moment when Winston’s torturer delineates the systemic horror of their existence.

O’Brien: How does one man assert his power over another, Winston?

Winston: By making him suffer.

O’Brien: Exactly. By making him suffer. Obedience is not enough. Unless he is suffering, how can you be sure that he is obeying your will and not his own? Power is in inflicting pain and humiliation. Power is in tearing human minds to pieces and putting them together again in new shapes of your own choosing. Do you begin to see, then, what kind of world we are creating? It is the exact opposite of the stupid hedonistic Utopias that the old reformers imagined. A world of fear and treachery and torment, a world of trampling and being trampled upon, a world which will grow not less but MORE merciless as it refines itself. Progress in our world will be progress towards more pain. The old civilizations claimed that they were founded on love or justice. Ours is founded upon hatred. In our world there will be no emotions except fear, rage, triumph, and self-abasement. Everything else we shall destroy — everything. Already we are breaking down the habits of thought which have survived from before the Revolution. We have cut the links between child and parent, and between man and man, and between man and woman. No one dares trust a wife or a child or a friend any longer. But in the future there will be no wives and no friends. Children will be taken from their mothers at birth, as one takes eggs from a hen. The sex instinct will be eradicated. Procreation will be an annual formality like the renewal of a ration card. We shall abolish the orgasm. Our neurologists are at work upon it now. There will be no loyalty, except loyalty towards the Party. There will be no love, except the love of Big Brother. There will be no laughter, except the laugh of triumph over a defeated enemy. There will be no art, no literature, no science. When we are omnipotent we shall have no more need of science. There will be no distinction between beauty and ugliness. There will be no curiosity, no enjoyment of the process of life. All competing pleasures will be destroyed. But always — do not forget this, Winston — always there will be the intoxication of power, constantly increasing and constantly growing subtler. Always, at every moment, there will be the thrill of victory, the sensation of trampling on an enemy who is helpless. If you want a picture of the future, imagine a boot stamping on a human face — for ever.

For those who watched the film 1984 with John Hurt and Richard Burton (Burton’s last role), Prebble’s reading as O’Brien is much more intense and malice-filled than Burton’s. (The quoted section above appears at about 1 hour 30 minutes into the film).


MetaWeblogSharp 1.1.2 Released

You can get the NuGet package here:

The source code is available on CodePlex:


While testing it out against my a Squarespace-based blog, I discovered that I needed to disable the use of the 100 Continue header for reliable communications.

This blog MSDN blog post provides a great summary about the issue:

In the end the fix was simple:

var request = System.Net.WebRequest.Create( “” );
var wr = (System.Net.HttpWebRequest) request;
wr.ServicePoint.Expect100Continue = false;

Page 1 ... 2 3 4 5 6 ... 66 Next 5 Entries »