0
votes

I'm trying to make a nuget package of an MVC 5 project, and i get the following error in the console.

C:\Projects>nuget pack WebApplication3\WebApplication3\WebApplication3.csproj

Attempting to build package from 'WebApplication3.csproj'. The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Users\Michael\Documents\Visual Studio 2013\Projects\WebApplication3\WebApplication3\WebApplication3.csproj

In the .csproj

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

I don't have VS 2010 installed on my machine. Just VS2013. What changes do i have to make in order for this to build and package?

1

1 Answers

3
votes

Landed on this thread and for anyone battling with this issue (who has Visual studio 2013 and also lands on this thread) and looking for a quick fix just copy this folder

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications

to

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0

See these links for further detail:

Link1 with specific reference to heading/section "WebApplication.Targets"

Link2 with reference to Jim Lamb's answer.