locked
MSTest, Targeting multiple Framework version RRS feed

  • Question

  • We use TFS (2010) for Continuous Integration. Solution Contains .NET 4 ,and Silverlight 4 projects. Everything was working fine, until one day MSTest.exe stopped running UnitTest dlls, with this message :A test run can only be targeted to single .Net framework version. Targeting multiple Framework version in single run is unsupported.

    What I did: I have checked to see if there has been any config changes in the solution, but discovered none. files with .Testsettings and .vsdmi are intact. Just found out that Visual Studio Service Pack 1 has run the night before.

    Also we have three branches on TFS, which use same controller and Agent. and all the builds have stopped working. I tried running MSTest from command-line on the build server, and same problem exists. seems if there are SL and .NET test dlls, MSTest does not work.

    The complete log for MSTest is here :

    Run MSTest for TestAssemblies

    C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\1\Product\Sources\OM\build.testsettings" /searchpathroot:"C:\Builds\1\Product\Binaries" /resultsfileroot:"C:\Builds\1\Product\TestResults" /testcontainer:"C:\Builds\1\Product\Binaries\OM.Views.Tests.dll" /testcontainer:"C:\Builds\1\Product\Binaries\OM.ApplicationServices.UnitTests.dll" /publish:"http://tfsServer:8080/tfs/DefaultCollection" /publishbuild:"vstfs:///Build/Build/3750" /teamproject:"Products" /platform:"Any CPU" /flavor:"Release" 
    Loading C:\Builds\1\Product\Sources\OM\build.testsettings...
    Loading C:\Builds\1\Product\Binaries\OM.ApplicationServices.UnitTests.dll...
    Loading C:\Builds\1\Product\Binaries\OM.ViewModels.Tests.dll...
    Starting execution...
    A test run can only be targeted to single
    .Net framework version. Targeting multiple Framework version in single run is unsupported.
    There are no results to be published.

    • Moved by Gautam Goenka [MSFT] Monday, January 16, 2012 11:53 AM (From:Testing with Visual Studio Test Manager (MTM))
    Monday, January 16, 2012 6:06 AM

Answers

  • Hi,

    You can use the InvokeProcess activity to call out to MSTest.exe and run the tests in your other assembly. See here for the commandline arguments. You probably want to use /testcontainer.\

    Aidan


    -Aidan
    • Proposed as answer by Forrest Guo Tuesday, January 31, 2012 1:17 AM
    • Marked as answer by Forrest Guo Saturday, February 4, 2012 9:35 AM
    Monday, January 23, 2012 2:00 PM

All replies

  • Kaveh,

    The message you see is specific and meaningful. In fact, this scenario is a known limitation to MSTest. The test assemblies you specified target different Framework versions. 

    A workaround for this scenario is:

    Running tests manually. Generate 2 different test lists, one for testing Silverlight code and the other one for testing .NET server side code.  See details in below picture.

    This way only one runtime (SL OR .NET) is activated during a test run…

    - Doubleclick on .vsmdi File in VS
    - Activate only one platform
    - Start tests for the selected platform
    - Then do the same for the other platform…

    Running tests in build. I'm afraid we can only specified Silverlight UnitTest dll, or Server side UnitTest dll exclusively.

     

    Please let me know if there's anything unclear, I'll try my best to assistant.


    Forrest Guo | MSDN Community Support | Feedback to us

    • Proposed as answer by TejasJ Thursday, January 19, 2012 4:55 AM
    • Marked as answer by Forrest Guo Thursday, January 19, 2012 9:40 AM
    • Unmarked as answer by Kaveh.Sh Tuesday, January 24, 2012 1:07 AM
    • Unproposed as answer by Forrest Guo Tuesday, January 31, 2012 1:17 AM
    Wednesday, January 18, 2012 1:59 PM
  • Kaveh,

    I mark it as answered, please let me know if there's anything unclear. I'll try to assistant.


    Forrest Guo | MSDN Community Support | Feedback to us

    Thursday, January 19, 2012 9:40 AM
  • Ather option is to use a separate Exec task inside the AfterTest target to run MSTest.exe against your DLL that is on a different platform. We do this successfully in a team build that produces .NET 3.5 and .NET 4 assemblies. The results are still published and reported with the build summary.
    -Aidan
    Friday, January 20, 2012 2:42 PM
  • Hi ,

    Forrest, thanks for your help.

    I want tests to be run in Build Machine, manual run is not an issue.

    there are a number of things things that I do not under stand :

    .How come our build process worked before VS2010 SP1 upgrade, and stopped after it?

    I cannot find Silverlight tests in Test List Editor. I am using Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight for testing. using browser to run tests.Is there something I am doing wrong?

    Aidan,

    I was thinking of editing BuildTemplate.xaml in the designer to add an extra step in testing. Can you point me to the activity that I need to change to  have a second step for SL testing?

    thanks

     

    Monday, January 23, 2012 1:26 AM
  • Hi,

    You can use the InvokeProcess activity to call out to MSTest.exe and run the tests in your other assembly. See here for the commandline arguments. You probably want to use /testcontainer.\

    Aidan


    -Aidan
    • Proposed as answer by Forrest Guo Tuesday, January 31, 2012 1:17 AM
    • Marked as answer by Forrest Guo Saturday, February 4, 2012 9:35 AM
    Monday, January 23, 2012 2:00 PM
  • Open "Test List Editor"

    Refresh all loaded tests.

    Try to run the test again. It should work now.


    Regards, Nanddeep Nachan

    • Proposed as answer by Nanddeep Nachan Wednesday, October 31, 2012 11:01 AM
    Wednesday, October 31, 2012 11:01 AM