Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

tfsbuild - Build VS2013 on a TFS Build Server With Only VS2013

I'm setting up a new build server to support a migration of our development team from VS2010 to VS2013. We are not migrating our TFS server just yet so the new build server has been set up as a VS2010 Build Controller with 2 Agents. I have also installed VS2013 on the machine (sledge hammer approach).

All our code has been migrated to target .Net 4.5.1 and compiles fine on a developer's workstation.

Most of our solutions build fine, except the solution that contains web projects. These projects are complaining:

The imported project "C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebApplicationsMicrosoft.WebApplication.targets" was not found.

The imported project is using the VisualStudioVersion variable in the build process through these two lines:

<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
...
<Import Project="$(VSToolsPath)WebApplicationsMicrosoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

which according to this page:

http://msdn.microsoft.com/en-us/library/vstudio/bb383796.aspx

will be set to "11.0" for both 4.5 and 4.5.1 targets. But the build machine only has a 12.0 version of the above path:

"C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0WebApplicationsMicrosoft.WebApplication.targets"

These same .csproj lines seem to be used in a brand new VS2013 project so I'm not sure how this could ever resolve correctly on a build machine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is due to Vs2012 adding in csproj file this part:

  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>

You can safely remove that part and your solution will build.

You have to ensure that the .proj file begin with <Project ToolsVersion="12" otherwise the next time you open the project with visual studio 2010, it will add the removed node again.

otherwise if you need to use webdeploy or you use a build server the above solution will not work but you can specify the VisualStudioVersion property in your build script:

msbuild myproject.csproj /p:VisualStudioVersion=12.0

or edit your build definition:

edit build definition to specify the <code>VisualStudioVersion</code> property


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...