Code Bye

error MSB4019: 未找到导入的项目Microsoft.WebApplication.targets

使用MSbuild编译项目时,控制台输出以下错误:error MSB4019: 未找到导入的项目“C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets”

This is very easy to do. Open your build definition and go to the “Process” page. Then under the “3. Advanced” group you have a property called “MSBuild Arguments”. Place the parameter there with the following syntax “/p:VisualStudioVersion=12.0”. Of course without the quotes. If you have more parameters, separate them with a space and not a comma.
echo off . copyRight.codebye.com

path %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\

msbuild.exe .\src\ElectricManagement.sln /t:Rebuild /p:Configuration=Release /p:VisualStudioVersion=12.0
::/l:FileLogger,Microsoft.Build.Engine;logfile=Build1.log

msbuild .\src\ElectricManagement.Web\ElectricManagement.Web.csproj /t:ResolveReferences;Compile /t:_WPPCopyWebApplication /p:Configuration=Release /p:VisualStudioVersion=12.0 /p:WebProjectOutputDir=..\..\Release codebye版权所有
::/l:FileLogger,Microsoft.Build.Engine;logfile=Build2.log

echo 编译当前项目完毕
pause

上述是E文原问题描述,看不懂没关系,每个人的情况不同,但是解决方式都是类似的,只需要在配置中找到编译的参数VisualStudioVersion

/p:VisualStudioVersion=12.0

//将以上参数改为系统已安装的visio Studio 版本对应的数字即可,例如
VS2013对应的版本为 12.0
VS2015对应的版本为 14.0

如此这般修改过之后即可正常编译项目。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明error MSB4019: 未找到导入的项目Microsoft.WebApplication.targets