I have recently installed the new Azure development tools for Visual Studio 2010 service pack 1. Every time that I try to publish an existing website (using file system depl
If editing in VS2012 (Visual Studio 2012) a VS2010 project try this. Edit the csproj file from:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
And change to:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" />
I had the same error. Somehow this line was missing.
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Added it just below
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Works fine now
For Visual Studio 2017 - it should be added after the block in the .csproj file, use notepad and look for ".targets" to locate it...
I created a new VS 2017 project and this is working for me (with no warnings):
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
This worked for me fix - gather all files to publish error
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />Add the following above the line.
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">13.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
Save and Reload project.
Same problem with VS2017. You can try this, it worked for me.
search the keyword "WebApplication.targets"
<Import Project="...\WebApplications\Microsoft.WebApplication.targets" ... >
COMMENT or REMOVE this line.(maybe two lines depending on "Condition")
In this step, it will prompt you to install some package about 500M...
After that, reload project, then it works!
I guess I just miss some components when I install VS 2017.
Also I notice the MSBuild Path is quite different in VS2017, but maybe that's not related to the problem cuz it uses relative path in the csproj file..
I ran into this issue with VS 2017 and I tried manually changing the csproj file as suggested here and none of the suggested fixes worked for me. I ran across this nuget package. Installing it worked for me.
MSBuild.Microsoft.VisualStudio.Web.targets