locked
error when running MSTest from command line RRS feed

  • Question

  • I have unit test project which I run on few servers at work. on few servers it's working just fine, but on one specific server when I run the tests from the command line I'm getting this error: "to be able to target your test project to .net framework 3.5, you must use the steps..." the project is set with 3.5 and if I run the tests from VS they work. the problem is from the command prompt. I'm not sure he doesn't think its in 3.5. any idea why I'm getting this 


    Tsahi Bar

    Monday, November 12, 2012 7:32 AM

All replies

  • Hello Tsahi,

    Thank you for posting in the MSDN forum.

    I would like to know which VS you are using.

    I assume that you are doing unit tests that target the .NET Framework3.5 in VS2010. About MSTest, which was dependent on the .NET Framework4.0 in the past, now is able to work with .NET Framework3.5 if you have installed Visual Studio Service Pack 1.

    To resolve this issue, I suggest that you need to make sure you have Visual Studio Service Pack 1 installed and target the test project to the .NET Framework3.5 through Project Properties->Application.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, November 13, 2012 1:16 AM
  • Hi Amanda,

    Yes, I'm using VS 2010 SP1. It was never dependent on .NET 4. and in project's properties I target it to 3.5. As I said it works on other servers and also on the current server, but only from inside VS.

    is there any different from running it from the command line to VS?

    can there be other issues beside it that can cause it?

    Thanks,

    Tsahi


    Tsahi Bar

    Tuesday, November 13, 2012 6:42 AM
  • Hello Tsahi,

    Glad to receive your reply.

    I would like to know what project you are unit testing for. We now have “basic support for unit tests that target the .NET Framework 3.5” in VS2010 with SP1. There are a lot of reasons for adding this functionality but the main reason for putting it in is to support doing unit tests for your SharePoint 2010 projects.

    If you are working with SharePoint 2010 projects, you can reference this article:

    http://blogs.msdn.com/b/zainnab/archive/2011/04/11/vs2010-sp1-new-features-unit-tests-for-framework-3-5.aspx

    You can try to change the Host Type to “Run in 64-bit process on 64-bit machine” to check if it helps.

    If you are working with Visual Basic and Visual C# unit test project, you can check the following article to make sure you actually have target the .NET Framework for them on the specific server successfully.

    http://msdn.microsoft.com/en-us/library/gg601487(VS.100).aspx

    If you run tests from command line on other servers, will you get the same error?

    Also I suggest that you can try to create a simple unit test that targets .NET Framework to run on the specific server to check if the error still will occur. Maybe there is anything wrong with the MSTest.exe.

    Can you provide more detailed error messages so that we can further look at this issue?

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, November 13, 2012 8:39 AM
  • Hello Tsahi,

    What about your issue now? Could you get useful information from our reply?

    Would you mind letting us know the result of the suggestion?

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 14, 2012 7:09 AM
  • Hi Amanda,

    I'm not working with SharePoint. I'm unit testing our BL project. I can not set it as .Net 4 because of compatibility issues we have in our projects. 

    I forgot to mention it, but yes I'm working with 64bit process. and it's defined in the Hosts section.

    As I said before running it from the command line on other server do work!

    I tried running few unit testing  projects that we have on the problamatic server and on all of them I got the same error

    Full error: "to be able to target your test project to .net framework 3.5, you must use the steps documented at the following Microsoft Web Site: http://go.microsoft.com/fwlink/?LinkId=201405"

    do you need any more data?

    Thanks,

    Tsahi


    Tsahi Bar

    Wednesday, November 14, 2012 8:39 AM
  • Hello Tsahi,

    You can run .net framework 3.5 project using MSTest on some servers but can’t succeed on some other servers, am I right?

    If yes, I would like to know you run the same project only including unit tests using MSTest on all servers.

    In the .NET Framework 3.5, multitargeting is supported for test projects that contain only unit tests. The .NET Framework 3.5 does not support any other test type, such as coded UI or load test. The re-targeting is blocked for test types other than unit tests.

    In addition, I suggest that you can open TestProject.csproj file with Notepad to check the TagetFrameworkVersion if you actually target the test project to .net framework 3.5.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 15, 2012 5:22 AM
  • Hi Amanda,

    yes you're correct.

    I'm basically running the same DLLs on different servers.

    the target framework in the project is 3.5 

    I also have the following key (I guess without it I couldn't have chosen 3.5)

    <add key="TestProjectRetargetTo35Allowed" value="true" />

    I guess maybe reinstalling VS will do the trick?

    Tsahi


    Tsahi Bar

    Thursday, November 15, 2012 7:39 AM
  • Hello Tsahi,

    It’s hard for us to repro your issue, I can’t confirm that reinstalling VS will resolve this issue. But you can try to do it.

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

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 15, 2012 7:55 AM
  • Hi Tsahi,

    Which .config file did you modify to include the above key ?.  If you are running test using mstest.exe, than this key should be added to mstest.exe.config.

    Thanks

    Tuesday, November 20, 2012 6:05 PM