In VS 2013+ msbuild moved out of the core .net framework and is available as a separate install for build agents know as “Build tools”.

You need to be aware that MsBuild has moved path for studio 2013 and 2015 - the path of msbuild in 2015 is C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe (moved from C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe in 2013 and C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe in 2012 and before). More info on the studio blog from 2013.

So if you want to do a scripted build with NAnt or are upgrading an existing one you need to check if they reference msbuild from the framework folder - and if you upgrade a solution to VS 2013 or 2015 and have a scripted build you probably need to change the path to msbuild to get the build to work correctly and match how you build locally.

The following NAnt snippet below execs msbuild directly rather than using the msbuild task (because that references the older path by default).

<property name="build.configuration" value="Release" unless="${property::exists('build.configuration')}"/>
<property name="build.platform" value="Any CPU" unless="${property::exists('build.platform')}"/>
<property name="build.out.dir" value="" unless="${property::exists('build.out.dir')}"/>
<property name="build.verbosity" value="Normal" unless="${property::exists('build.verbosity')}"  />
<property name="solution.name" value="${project::get-name()}" unless="${property::exists('solution.name')}"/>
<property name="solution.extension" value="sln" unless="${property::exists('solution.extension')}"/>
<property name="solution.dir" value="${project::get-base-directory()}"  unless="${property::exists('solution.dir')}"/>
<property name="package.dir" value="${solution.dir}\_release"/>
<property name="msbuild-VS2013" value="C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe" unless="${property::exists('msbuild-VS2013')}"/>
<property name="msbuild-VS2015" value="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" unless="${property::exists('msbuild-VS2015')}"/>
<property name="msbuild.args" value="/p:RunOctoPack=true;OctoPackPublishPackageToFileShare=${package.dir}" />

<target name="compile-solution">
    <exec program="${msbuild-VS2015}" verbose="true">
        <arg line='"${solution.dir}\${solution.name}.${solution.extension}"' />
        <arg value="/property:Configuration=${build.configuration}"/>
        <arg value="/property:Platform=${build.platform}"/>
        <arg value="/property:OutDir=${build.out.dir}"/>
        <arg value="/target:Rebuild"/>
        <arg value="${msbuild.args}" if="${property::exists('msbuild.args')}"/>
    </exec>
</target>