<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<!-- This file can be used to compile C# applications against other .NET Framework versions -->
	
	<PropertyGroup>
		<!--
			Save original target framework version because we'll need to change it
 		-->
		<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v2.0</TargetFrameworkVersion>
		<SharpDevelopTargetFrameworkVersion>$(TargetFrameworkVersion)</SharpDevelopTargetFrameworkVersion>
		<SharpDevelopTargetFrameworkClass>unknown</SharpDevelopTargetFrameworkClass>
	</PropertyGroup>
	
	<PropertyGroup Condition=" ('$(SharpDevelopTargetFrameworkVersion)' == 'v2.0' or '$(SharpDevelopTargetFrameworkVersion)' == 'v3.0' or '$(SharpDevelopTargetFrameworkVersion)' == 'v3.5') ">
		<SharpDevelopTargetFrameworkClass>v2</SharpDevelopTargetFrameworkClass>
	</PropertyGroup>
	
	<PropertyGroup Condition=" '$(SharpDevelopTargetFrameworkVersion)' == 'CF 2.0' ">
		<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
		<SharpDevelopTargetFrameworkClass>CF</SharpDevelopTargetFrameworkClass>
	</PropertyGroup>
	<PropertyGroup Condition=" '$(SharpDevelopTargetFrameworkVersion)' == 'CF 3.5' ">
		<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
		<SharpDevelopTargetFrameworkClass>CF</SharpDevelopTargetFrameworkClass>
	</PropertyGroup>
	
	<!-- Show an error when CF is not installed, or when the target framework is unknown. -->
	<Target Name="Build">
		<Error Text="'$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets' cannot be found." Condition=" ('$(SharpDevelopTargetFrameworkClass)' == 'CF') and (!Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')) "/>
		<Error Text="Unknown target framework version '$(SharpDevelopTargetFrameworkVersion)'."/>
	</Target>
	
	<Target Name="Rebuild">
		<Error Text="'$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets' cannot be found." Condition=" ('$(SharpDevelopTargetFrameworkClass)' == 'CF') and (!Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')) "/>
		<Error Text="Unknown target framework version '$(SharpDevelopTargetFrameworkVersion)'."/>
	</Target>
	
	<Target Name="Clean">
		<Error Text="'$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets' cannot be found." Condition=" ('$(SharpDevelopTargetFrameworkClass)' == 'CF') and (!Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')) "/>
		<Error Text="Unknown target framework version '$(SharpDevelopTargetFrameworkVersion)'."/>
	</Target>
	
	<!-- Use Microsoft's C# standard targets -->
	<Import Condition=" ('$(SharpDevelopTargetFrameworkClass)' == 'v2') "
	        Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
		
	<!-- Compact framework property adjustments: -->
	<!-- When StdLib is not set, set it to true and add reference to mscorlib -->
	<!-- Set PlatformFamilyName and PlatformID if required -->
	<PropertyGroup Condition=" '$(SharpDevelopTargetFrameworkClass)' == 'CF' ">
		<PlatformFamilyName Condition=" '$(PlatformFamilyName)' == '' ">PocketPC</PlatformFamilyName>
		<PlatformID Condition=" '$(PlatformID)' == '' ">WinCE</PlatformID>
		
		<SharpDevelopAddReferenceToCompactMscorlib Condition="'$(NoStdLib)' == ''">true</SharpDevelopAddReferenceToCompactMscorlib>
		<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
	</PropertyGroup>
	
	<ItemGroup Condition=" '$(SharpDevelopAddReferenceToCompactMscorlib)' == 'true' ">
		<Reference Include="mscorlib"/>
	</ItemGroup>
	
	<!-- Compact framework imports -->
	<Import Condition=" ('$(SharpDevelopTargetFrameworkClass)' == 'CF') and (Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')) "
	        Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets"/>
</Project>
