解决方法:
1、用记事本打开
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets
2、找到以下xml节点修改成:
<Target Name="GetAspNetMergePath" DependsOnTargets="$(GetAspNetMergePathDependsOn)" Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))" Text="Can't find the valid AspnetMergePath" />
</Target>
3,重点:
以上xml中
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
如果是vs2015,将文件:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets
的节点换成
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\</TargetFrameworkSDKToolsDirectory>
欢迎指正