locked
Visual Studio 2012 and 2010 on the same build machine RRS feed

  • Question

  • Our software is developed using Visual Studio 2010. We have a TFS2010 server and automated builds. Now I'm investigating migration to Visual Studio 2012. As a part of the tests I installed VS 2012 on one of the build machines and as a result all builds fail......

    Looking at the logs it seems as the build agent is using VS 2012 to build our VS 2010 solutions. How can I force the build agent to use VS 2010 to build the VS 2010 solutions?

    Monday, October 8, 2012 2:46 PM

Answers

  • 1. VS2012 installs Framework 4.5.
    2. Framework 4.5 is an inplace upgrade of Framework 4.0. They basically update Framework 4.0. So if you have VS2010 and VS2012, they both are using the same version Framework 4.5
    3. Technically, this version is backward compatible. The moment you install VS2012, it updates to latest framework.
    4. You cannot force it to build using VS2010 when VS2012 is installed.
    We have to get the build log and see what is failing. This is most likely a Msbuild issue. Since this will take more time to research depends on the error you are getting, please call Microsoft technical support and set up a support case to get further help on this.
    • Marked as answer by HeLa75 Wednesday, October 24, 2012 7:13 AM
    Wednesday, October 24, 2012 12:45 AM

All replies

  • Hi,

    Firstly confirm whether your solution and project files in not Visual Studio 2012 format

    If you are using upgrade template, one way to enforce the version of visual studio is use the VSDev task in the MSBuild Extension pack. You  will need to replace the SolutionsToBuild ItemGroup with calls to the VsDevEnv task passing in 10.0 in the version attribute.

    If you are using DefaultTemplate, you will need to edit the call to MSBuild activity.

    Monday, October 8, 2012 4:31 PM
  • Hi,

    Firstly confirm whether your solution and project files in not Visual Studio 2012 format

    If you are using upgrade template, one way to enforce the version of visual studio is use the VSDev task in the MSBuild Extension pack. You  will need to replace the SolutionsToBuild ItemGroup with calls to the VsDevEnv task passing in 10.0 in the version attribute.

    If you are using DefaultTemplate, you will need to edit the call to MSBuild activity.

    We are using DefaultTemplate (TFS2010 Workflow). The solution file is VS2010 format.

    Some googling of this gives that there is a ToolsVersion property on each project file. The ToolsVersion property is "4.0" for both VS2010 and VS2012. That seems to be the reason why my projects are being built with VS2012.

    Tuesday, October 9, 2012 7:30 AM
  • The toolsVersion property specifies the version of .net framework to use to build the projects. Not sure how it would impact which version of visual studio to use.

    Tuesday, October 9, 2012 8:08 AM
  • If you look at a VS 2010 project file it looks like:

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
      <PropertyGroup>
          ...
        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
        ...
      </PropertyGroup>
      ...
    </Project>

    while a VS 2012 project file looks like

    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        ...
        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
        ...
      </PropertyGroup>
      ...
    </Project>

    MsBuild has a VisualStudioVersion build property to choose Visual Studio version, but I cannot get it to work for me.

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

    Tuesday, October 9, 2012 3:08 PM
  • So, you are saying you have set the target framework property of your projects to .Net Framework 4.5? If that is the case you cannot use Visual Studio 2010 to compile these projects as it does not support compilation to 4.5. 

    Tuesday, October 9, 2012 4:25 PM
  • So, you are saying you have set the target framework property of your projects to .Net Framework 4.5? If that is the case you cannot use Visual Studio 2010 to compile these projects as it does not support compilation to 4.5. 

    No, my projects use framework 4.0. The above posts were just to point out that the ToolsVersion cannot be used to determine the Visual Studio version.

    As you can see above ToolsVersion is 4.0 for both VS2010 and VS2012. The TargetFrameworkVersion property is used to determine the.NET framework version.

    Thursday, October 11, 2012 11:28 AM
  • Are you planning to keep using TFS2010 but have the build machine build both .NET 4.0 and 4.5 projects?

    Ahmed is an independent consultant in Ottawa, Canada specialized in .NET, Biztalk, WCF, WPF, TFS and other Microsoft technologies.

    Blog: http://lajak.wordpress.com

    Twitter: ahmedalasaad

    Sunday, October 14, 2012 2:59 AM
  • Are you planning to keep using TFS2010 but have the build machine build both .NET 4.0 and 4.5 projects?


    No, my goal is to have one build agent with both VS2010 and VS2012 installed. The builds building VS2010 solutions must use VS2010 to build and the VS2012 solutions must use VS2012.

    The problem is that as soon VS2012 was installed on the build agent all solutions are built with VS2012, which cause errors in some VS2010 solutions.

    Monday, October 15, 2012 12:25 PM
  • Hi Hela,

    Thank you for your post.

    I am trying to involve someone to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 17, 2012 8:47 AM
    Moderator
  • What is the exact build error you are getting?

    Could you turn on build logging verbosity to "diagnostic" under Build definition, processes and send detail build log from both your IDE output windows (build activity log)  and your build drop folder the build log?

    Thursday, October 18, 2012 12:32 AM
  • Maybe I was a bit unclear in my first post. The errors I get on the build machine are exactly the same as I get when I compile the same solution on my developer PC using VS2012.

    VS2012 seems to be more strict on added references and as a result of that our VS2010 solution does not compile with VS2012.

    The problem on the build machine is that the build agent uses VS2012 to compile my VS2010 solution and as a result I get the same reference errors as I get on my developer PC.

    Thursday, October 18, 2012 7:10 AM
  • I still would like to know more detail on the exact errors you were getting and build activities. Could you email me your drop folder content (zipped)? Please send it to CTS_shaoweil_at_live_dot_com (please convert it to real email address)
    Thursday, October 18, 2012 8:00 PM
  • 1. VS2012 installs Framework 4.5.
    2. Framework 4.5 is an inplace upgrade of Framework 4.0. They basically update Framework 4.0. So if you have VS2010 and VS2012, they both are using the same version Framework 4.5
    3. Technically, this version is backward compatible. The moment you install VS2012, it updates to latest framework.
    4. You cannot force it to build using VS2010 when VS2012 is installed.
    We have to get the build log and see what is failing. This is most likely a Msbuild issue. Since this will take more time to research depends on the error you are getting, please call Microsoft technical support and set up a support case to get further help on this.
    • Marked as answer by HeLa75 Wednesday, October 24, 2012 7:13 AM
    Wednesday, October 24, 2012 12:45 AM
  • 4. You cannot force it to build using VS2010 when VS2012 is installed.
    Ok, the statement above answered my question. Thanks for the help!
    Wednesday, October 24, 2012 7:13 AM