The imported project Microsoft.WebApplications.targets was not found

后端 未结 10 1061
野的像风
野的像风 2021-01-07 18:15

I have this error when configuring continuous integration in TFS server, but found the answer already. Maybe this will help others:

The imported project \"C:         


        
相关标签:
10条回答
  • 2021-01-07 18:41

    And if you already have Visual Studio installed? Perhaps you have Visual Studio 2012 installed (and 10.0 indicates VS 2010)? If that's the case, you can just search your .csproj file for "10.0" and replace that with "11.0" and you'll then be able to open the project just fine.

    0 讨论(0)
  • 2021-01-07 18:42

    If you don't deploy from the build server, then just turn off the Microsoft.WebApplication.targets on the build server. See my answer here: https://stackoverflow.com/a/35781566/4955344

    0 讨论(0)
  • 2021-01-07 18:43

    I had this problem as well except that this files were already there. After a lot of troubleshooting the answer turned out to be frustratingly simple: restart the build agent service. In my case it was: "Visual Studio Team Foundation Build Service Host 2013"

    0 讨论(0)
  • 2021-01-07 18:46

    I experienced something similar.

    I had written this in our Autobuild.targets file run as part of a build. It defines MSWebApplicationTargets:

    <MSWebApplicationTargets>$(SolutionDirectory)\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3</MSWebApplicationTargets>
    

    Then in a .csproj file that is part of the project and used in the build it had:

    <Import
         Project="$(MSWebApplicationTargets)/tools/VSToolsPath/WebApplications/Microsoft.WebApplication.targets" />
    

    Now our problem was that when we opened the project in Visual Studio it said that c:/tools/VSToolsPath/WebApplications/Microsoft.WebApplication.targets doesn't exist (because VS considered MSWebApplicationTargets to be undefined and so seemed to default it to c:\). You don't provide enough information though perhaps that is what caused your problem also.

    All I had to do to solve this was add a condition:

    <Import 
        Project="$(MSWebApplicationTargets)/tools/VSToolsPath/WebApplications/Microsoft.WebApplication.targets" 
        Condition="'$(MSWebApplicationTargets)' != ''" />
    

    Why do this with Microsoft.WebApplication.targets

    As part of some futher discussion, I did this with Microsoft.WebApplication.targets so we didn't have to rely on Visual Studio being installed on the build servers. I added it as a dependency:

    • In Visual Studio right-click on the project and go to manage nuget packages. This created a packages.config file that listed MSBuild.Microsoft.VisualStudio.Web.targets as a dependency.
    • I then added nuget.exe restore to the start of the build script so that the dependencies are downloaded.
    0 讨论(0)
提交回复
热议问题