Invalid value for ‘OSVersion’

If you have a Visual Studio Solution that is failing to build with the error message Invalid value for ‘OSVersion’ the simplest way to fix this is to set an explicit value for OSVersion in your project file;

  1. Navigate to your projects folder in the file system
  2. Locate the project file (.csproj for C# .vbproj for VB)
  3. Open the project file in Notepad (or any other text editor)
  4. Modify the file to include an <OSVersion /> tag inside the first Property Group tag

for example

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="">
    <OSVersion />

This issue seemed to first surface in VS2005 and is still present in VS2008, it seems to regularly rear its head when you try to deploy your application using Click Once.