2

I have an ASP.NET MVC Web Application created in VS2013 and use TeamCity 8.1 for CI.

I'm trying to restore my Nuget packages before building my Visual Studio solution using a Nuget Pack build step in TeamCity and get this error:

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 <Import> declaration is correct

It's trying to access the targets in the wrong path because I use version 12.0 and not 10.0.

My solution file starts with this lines:

  Microsoft Visual Studio Solution File, Format Version 12.00
  # Visual Studio 2013
  VisualStudioVersion = 12.0.30501.0

The project file of my MVC project created in VS2013 have a this declaration of VisualStudioVersion

  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
 ...
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

I suppose the declaration of VisualStudioVersion is the reason to why the build step of restoring Nuget packages is accessing the wrong folder. But I'm not sure what the condition in property VisualStudioVersion is evaluated to.

I've tried to create an Environment variable for VisualStudioVersion and set it to 12.0 but that did not work.

The strange thing is if I disable the Nuget Pack step in TeamCity the build step seems to find the correct path

Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\17b24c83f45b721d "/msbuildPath:C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe"
Edminsson
  • 2,426
  • 20
  • 25

0 Answers0