Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6065345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:22:48+00:00 2026-05-23T09:22:48+00:00

I converted a solution from VS2008 to VS2010 SP1, and changed the unit test

  • 0

I converted a solution from VS2008 to VS2010 SP1, and changed the unit test project to target the 3.5 framework. Other than having to fix a few references in the unit test project, everything worked ok and the solution built successfully. Most of the tests run successfully, but there were a handful that failed. The ones that failed are using a private accessor. Personally, I’d rather just remove these tests since I don’t think they’re necessary, but as long as it reveals a potential bug in SP1, I thought I’d see if anyone could figure out a work-around.

The error message that I receive when running the tests is “This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.”
As best as I can tell, it appears that the private accessor assembly is being built by the 4.0 runtime (most likely via Microsoft.VisualStudio.QualityTools.UnitTestFramework), but since the 3.5 runtime is loaded by MSTest, the resulting error occurs.

I tried changing the reference for Microsoft.VisualStudio.QualityTools.UnitTestFramework to specifically use version 9.0 (currently it is 10.1). This results in a compile time error which says that the private accessor assembly uses version 10.0 of Microsoft.VisualStudio.QualityTools.UnitTestFramework, which is higher than version 9.0.

I’ve deleted the generated private accessor assembly and recreated it as well, and still have the same issue. It would seem that something is out of sync with VS2010 SP1 when the 3.5 framework is targeted in a unit test project.

Here is the code for one of the unit tests (again, not a very valuable test, but that’s not the point of the post…):

    [TestMethod()]
    public void GetNullableCharValue_DBNull_ReturnsNull_Test()
    {
        object value = DBNull.Value;
        Nullable<char> expected = null;
        Nullable<char> actual;
        actual = RepositoryBase_Accessor.GetNullableCharValue(value);
        Assert.AreEqual(expected, actual);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:22:48+00:00Added an answer on May 23, 2026 at 9:22 am

    I ran into this problem as well. Visual Studio 2010 SP1 adds support for unit test projects based on .NET v3.5; previously unit tests were forced to use .NET4.

    There is a Microsoft Connect bug on the subject but it was just filed the day I’m writing this answer so there is no meaningful response from Microsoft yet.

    The workaround I chose was to manually generate the private accessor assembly using Visual Studio 2008 toolchain and add a manual reference to it from the unit test project.

    The steps are:

    1) Remove the autogenerated accessor from the unit test .csproj file:

    <ItemGroup>
      <Shadow Include="Test References\Assembly.accessor" />
    </ItemGroup>
    

    2) Create the v3.5 compatible accessor assembly using Publicize VS2008:

    "%VS90COMNTOOLS%vsvars32.bat"
    publicize Assembly.dll
    

    3) Copy the assembly to the source tree folder, e.g. under a folder Accessors:

    copy Assembly_Accessor.dll ProjectDir\Accessors\Assembly_Accessors.dll
    

    4) Add the accessor assembly as a reference to the unit test project using the Visual Studio interface:

    Project -> Add Reference.. -> Browse...
    

    5) Build your solution with Ctrl+Shift+B and run your tests.

    You can now either check in the generated assembly or create it automatically in a pre-build event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I converted my solution to run with VS2010 from VS2008. But I'm still running
I converted from VS2008 to VS2010. when I build the solution it gets frozen
I converted my visual studio solution from 2008 to 2010. A project has a
I've just converted my ASP.NET MVC1 VS2008 .NET3.5 solution to ASP.NET MVC3 VS2010 .NET4.0
I converted a solution from VS2008/.NET 3.5 to VS 2010/.NET 4. I'm getting this:
I've got my brand new VS2008 and decided to convert my main solution from
We've converted our solution from .NET 2.0 to .NET 3.5. All projects converted just
I recently converted a multi-project Visual Studio solution to use .dlls instead of .libs
I have a VS2008 Professional solution that I tried to convert to VS2010 Professional
I’m trying to upgrade our solution from VS2005 .NET 2.0 to VS2008 .NET 3.5.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.