次の方法で共有


Additional Steps for enabling re-targeting of Test Projects to .Net Framework 3.5 in VS 2010 SP1 Beta

 

Visual Studio 2010 Service Pack 1 enables basic support for unit
tests that target .Net framework 3.5.  If
the devenv.exe.config file has been modified by the user before applying this
Service Pack, then additional steps are required to enable the feature. (This
can typically happen if you have installed Visual Studio add-ons/plugins that have
modified the devenv.exe.config file. The Service Pack setup does not overwrite
the config file if it has been modified, hence
these additional steps are required)

If the devenv.exe.config file is not updated, the user will
see the following message when attempting to re-target .Net framework for a
Test Project to 3.5 in VS 2010 SP1

 

If the devenv.exe.config file is not updated, the user will
see the following message when opening a Visual Studio 2010 Test Project that
was targeted .Net Framework 3.5 via another installation of Visual Studio 2010
SP1

 

The following are the additional steps that are required to enable re-targeting of Test Projects to .Net Framework 3.5:

1.      
Close all running instances of Visual Studio

2.      
Open Visual Studio Command Prompt as an
Administrator

3.      
cd to  "%programfiles%\Microsoft
Visual Studio 10.0\Common7\IDE" on a 32 bit OS or "%programfiles(x86)%\Microsoft
Visual Studio 10.0\Common7\IDE" on a 64 bit OS

4.      
Open devenv.exe.config file in a text
editor  (e.g. notepad.exe)

5.      
Add the following entries under   <assemblyBinding>
node

 

 

 <dependentAssembly>

        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>

        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>

        </dependentAssembly>

        <dependentAssembly>

        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>

        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>

        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>

        <bindingRedirect oldVersion="10.1.0.0" newVersion="10.0.0.0"/>

      </dependentAssembly>

   

6.      
Add the following  entry under <configuration> Node

<appSettings>

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

 </appSettings>

7.      
Save the devenv.exe.config file

8.      
Repeat the steps with mstest.exe.config if it
has been modified before applying the Service Pack

9.      
The following is a sample showing how the file
should look after the above updates

 

 

10.  
Restart Visual Studio IDE, re-targeting of .Net
framework for a Test Project to 3.5 should now succeed.

Comments

  • Anonymous
    March 09, 2011
    Is this still applicable to SP1 RTM? The error message still directs the user to THIS page...

  • Anonymous
    March 11, 2011
    I'm noticing weird behaviour.  Can anyone reproduce this? When I change the target framework version, the conversion wizard runs and the report indicates that my *Tests.VSTS.csproj file has been converted, and that the project file was also backed up in a separate directory. However, when I check the test project, I see that it is still targeting .NET 4.0. However, the csproj file in the backup directory has a <TargetFrameworkVersion> of 3.5. Is this behaviour reversed for anyone else?

  • Anonymous
    March 14, 2011
    I have the productivity pack installed for VS 2010 and if I make these changes the dock well and solution navigator add-ins fail to initialize.  Then when I try and open a solution VS 2010 crashes.

  • Anonymous
    March 16, 2011
    "Restart Visual Studio IDE, re-targeting of .Net framework for a Test Project to 3.5 should now succeed." Except it doesn't - it just sets the target framework straight back to 4.0 whether you run the wizard or not.

  • Anonymous
    March 17, 2011
    The comment has been removed

  • Anonymous
    March 28, 2011
    How does this work?  The 10.1 assemblies are compiled against .NET 2.0 (cool) but when you run mstest.exe, the binding redirects cause the 10.0 assemblies (compiled against .NET 4) to be used.

  • Anonymous
    March 30, 2011
    I tried the above and it caused my visual studio 2010 sp1 (never installed a beta sp1) to open without any content.  Just titlebar.  luckily I made a backup copy of both files before I started.  (I would suggest you add that step to your instructions). any other suggestions?  (contact me at peterkellner.net/contact) Peter Kellner http://peterkellner.net Microsoft MVP, ASP.NET

  • Anonymous
    April 01, 2011
    Not working for me, either, against SP1 proper.  Visual Studio crashes when trying to open a solution.

  • Anonymous
    April 06, 2011
    Same thing. It's broken. Definately not user error. I followed the above directions and now after I retarget the test it converts it immediately to .Net v4. Which is obviously not what anyone wants when they are retargeting to a lower version! ;) Please fix this ASAP. This is also against SP1 RTM.

  • Anonymous
    April 18, 2011
    After also having some trouble I found a solution working for me. For enabling re-targeting a test project to .net 3.5 the article states that one must add the <appSettings> tag under the <configuration> node in the devenv.exe.config file. The important part is: Do not add the <appSettings> tag above the <configSections> node! As long as the <configSections> node is NOT the first childnode of <configuration>, my Visual Studio pops up several error messages (like "The .NET Trace handling fails. Please check your .Net machine and enterprise configuration") and crashes if I try to open any solution. After I put the <appSettings> tag somewhere AFTER <configSections>, Visual Studio started up correctly and I could re-direct the test project to .net 3.5. I currently work with: Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel Microsoft .NET Framework Version 4.0.30319 SP1Rel

  • Anonymous
    April 27, 2011
    Folks, Thanks for reporting the issues, we are investigating them and wil update back. Thanks, Abhishek

  • Anonymous
    January 05, 2012
    The comment has been removed