Skip to content

Instantly share code, notes, and snippets.

@kos59125
Created September 4, 2012 02:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kos59125/3615961 to your computer and use it in GitHub Desktop.
Save kos59125/3615961 to your computer and use it in GitHub Desktop.
MSBuild で FizzBuzz
<?xml version="1.0" encoding="utf-8" ?>
<!--
To run: MSBuild /nologo /verbosity:minimal fizzbuzz.proj
-->
<Project DefaultTargets="FizzBuzz"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Current)' == '' ">
<Current>1</Current>
</PropertyGroup>
<Choose>
<When Condition=" $([MSBuild]::Modulo($(Current), 15)) == 0 ">
<PropertyGroup>
<Display>FizzBuzz</Display>
</PropertyGroup>
</When>
<When Condition=" $([MSBuild]::Modulo($(Current), 5)) == 0 ">
<PropertyGroup>
<Display>Buzz</Display>
</PropertyGroup>
</When>
<When Condition=" $([MSBuild]::Modulo($(Current), 3)) == 0 ">
<PropertyGroup>
<Display>Fizz</Display>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<Display>$(Current)</Display>
</PropertyGroup>
</Otherwise>
</Choose>
<Target Name="FizzBuzz" Condition=" $(Current) &lt;= 100 ">
<Message Text="$(Display)" Importance="high" />
<MSBuild Projects="$(MSBuildProjectFile)"
Properties="Current=$([MSBuild]::Add($(Current), 1))" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment