4

I was wondering if someone has ran into this problem as I have tried everything to fix. I have a DevOps build pipeline in Azure running visual studio 2015 version (which matches my local machine) and I am running into this error

Error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found

It builds perfectly fine on my machine. I have no idea why I cannot get this to build fine on DevOps.. and I haven't seen many questions about it. I went ahead and changed the vb.proj file to reflect the following and it still did not work

    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
    <!--Add the below line to fix the project loading in VS 2017 -->
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <!--End -->
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />```

ThatDevOpsGuy
  • 41
  • 1
  • 2
  • I've been battling this for months on end with no real results - especially on the build server. Recently we went from TFS2013 to DevOps 2020; exact same error. You are on the correct path. Its something with those import tags. – Christian Nov 26 '20 at 07:53
  • ideas: https://stackoverflow.com/questions/3980909/microsoft-webapplication-targets-was-not-found-on-the-build-server-whats-your – aloisdg Jan 04 '21 at 17:04

1 Answers1

0

It is possible that your project is referring to VS 2017 somewhere. Double-check all your solution and proj files for any reference to VS 2017.

Try to enable debug mode and gather more info.

Pierre.Vriens
  • 7,225
  • 14
  • 39
  • 84
geeky_girl
  • 81
  • 3