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
I had a similar issue after having upgraded from Visual Studio 2015 to 2017. When I try to load the web application project, it throwed me the error message:
The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found. Also, tried to find "WebApplications\Microsoft.WebApplication.targets" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" . These search paths are defined in "C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\15.0_558e146f\devenv.exe.config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths.
The solution to this error I found here.
In my case, the .csproj file contained the following lines:
14.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0
After replacing the v14.0 by v$(VisualStudioVersion) in the VSToolPath tag, the project could be loaded.
I also replaced the v14.0 by v10.0 in the VisualStudioVersion tag, as the solution in the above link shows. But for me it also worked by leaving it at 14.0.
Here is how these lines should look in the end:
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
If you don't have these lines at all in your .csproj, then you have to add them manually right BEFORE this line:
In my case (slightly different error message but same problem) it was this line:
It seems that projects created with Visual Studio versions since 2011 contain the lines with the VSToolsPath redefinition, while older files did not. Visual Studio never added them automatically when upgrading to a newer VS version, which is why you should add them if they are not there.
Source of this information: https://developercommunity.visualstudio.com/content/problem/27735/project-fails-to-load-with-error-regarding-microso.html?childToView=123664#comment-123664 (click on Show more comments to see the full discussion thread - unfortunately I cannot directly link to comments in this "more" section.)