Instantly share code, notes, and snippets.

Embed
What would you like to do?
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