Inspections (.Net) always use VisualStudioVersion 11 (TeamCity


I recently setup TeamCity and Installed VS2013 only.

And now that I'm trying to configure my first build, it appears that the Inspections (.Net) always use 11 for the $(VisualStudioVersion) variable. I tried passing /p:VisualStudioVersion=12.0 , adding VisualStudioVersion in environment variables and passing VisualStudioVersion as a parameter in the teamcity build but none of those seemed to be recognized by the Inspections. I even tried changing the Format Version to 13.0 in the .sln file because MSBUILD uses format -1

I am getting this error

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\TeamCity\buildAgent\work\46ad6f58c6b28d81\dev\Initial Dev\src\Website\CMS\CMSApp.csproj at (26093:3)

(I do not have the file above because I didn't install VS 2012)

I opened the project file from the path mentioned above and the here's how it looks like:

    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

I also tried adding VSToolsPath with a value of C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0 in system environment variable but it didn't work.

I'm clueless now where Inspections (.Net) is getting its variable.

Note that when I add a Visual Studio (.sln) build step, these variables are getting recognized as to what I set.

I think this may be solved by installing visual studio 2012 or simply copying that file to the folder where it is looking into but I want to know if this is a bug or a known issue.



1 comment
Comment actions Permalink


It is a known issue - and we are going to add MSBuild parameters in TeamCity. Please watch/vote for it.
As for now please you can use the workaround suggested here.


Please sign in to leave a comment.