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 -->
  <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" />```

  • 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 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.