Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
802 views
in Technique[技术] by (71.8m points)

visual studio - MS-Build 2017 "Microsoft.WebApplication.targets " is missing

I'm trying to upgrade our buildserver (jenkins) from Visual Studio 2015 to 2017. We're building via MS-Build. I've downloaded and installed MS-Buld tools as described in this answer. If I compile my projects I get an error that Microsoft.WebApplication.targets was not found.

Detailed error:

 error MSB4226: The imported project "C:Program Files (x86)Microsoft Visual Studio2017BuildToolsMSBuildMicrosoftVisualStudiov15.0WebApplicationsMicrosoft.WebApplication.targets"

I performed a find in the MS-Build directory:

PS C:Program Files (x86)MSBuild> dir -Recurse -Filter "Microsoft.WebApplication.targets"


    Directory: C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebApplications


Mode                LastWriteTime         Length Name                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                            
-a----       11.01.2012     00:23          19654 Microsoft.WebApplication.targets                                                                                                                                                                                


    Directory: C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0WebApplications


Mode                LastWriteTime         Length Name                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                            
-a----       22.07.2013     01:25          19995 Microsoft.WebApplication.targets                                                                                                                                                                                


    Directory: C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0WebApplications


Mode                LastWriteTime         Length Name                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                            
-a----       06.07.2015     21:55          20118 Microsoft.WebApplication.targets                                                                                                                                                                                


    Directory: C:Program Files (x86)MSBuildMicrosoftVisualStudioWebApplications


Mode                LastWriteTime         Length Name                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                            
-a----       22.07.2013     01:25          19995 Microsoft.WebApplication.targets
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like you are missing the workload for "Web development build tools": Microsoft.VisualStudio.Workload.WebBuildTools.

You can install it by downloading the build tools installer from here (VS2017) or here (VS2019) then running

vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools

or opening vs_buildtools.exe and selecting the "Web development build tools" component in the GUI:

screenshot from GUI


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...