Even after installing VS2010 SP1, unit tests targeting 3.5 framework fail if they are using private accessor - by avinash.kumar.vaidhya

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 677203 Comments
Status Closed Workarounds
Type Bug Repros 6
Opened 6/28/2011 1:16:39 AM
Access Restriction Public


Unit tests targeting framework 3.5 fail if they are using private accessor. The "xxxxLib.accessor" file is generated
    (a)  At path:   "\Test References\ xxxxLib.accessor". 
    (b) Contains: just two lines
           1.	LibraryName.dll
           2.	Desktop

I guess they (or any dependency of them) are compiled using a framework version < 3.5.
Sign in to post a comment.
Posted by JamnC on 6/14/2012 at 9:44 AM
I am still having this issue with the latest updates to Visual Studio 2010 SP1.

I switched the test project to .NET 3.5, regenerated the accessor dlls and still received this error.

When I switch back to .NET 4.0 it runs correctly.
Posted by Kerray on 4/23/2012 at 4:11 AM
I'm trying to unit test using accessor classes in a SharePoint 2010 project.

I have Visual Studio with latest patches.

Despite switching the test project to target .NET 3.5, the generated accessor dlls are for .NET 4 - and unusable.

If this is solved, how do I change also the accessor dlls to 3.5 without a workaround through VS2008 please?
Posted by forty7 on 4/10/2012 at 7:53 AM
This is marked "Fixed" but I see no indication of which release or patch fixes the issue.
Posted by kiroc on 9/6/2011 at 1:19 PM
This fails with me as well. I have VS 2010 SP1. It seems to fail only when I use resource files. I can build and use a test project with private accessors that targets the 3.5 framework. But, when I add a default resources file, the build breaks with a BadImageFormatException similar to the others mentioned here. It seems this is fixed in TFS 2010 TeamBuild (see adamroot's response to the question about VS 2010 RTM):


Could we get the TeamBuild targets file that (Microsoft.TeamTest.OverrideTasks) that would fix our local builds? It is not possible for some of us to move the test project to the 4.0 framework. In my case, we are using a 3rd party library that doesn't support the 4.0 framework.
Posted by PeteA on 7/6/2011 at 10:32 AM
I am using VS 2010 SP1. I opened a project created by VS 2010 prior to SP1 and was seeing the issue of previously working tests failing with "System.BadImageFormatException: Could not load file or assembly 'ActiveDirectoryUCMPersonalizationConnector_Accessor, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
Posted by MS-Moderator07 [Feedback Moderator] on 6/29/2011 at 10:37 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by avinash.kumar.vaidhya on 6/29/2011 at 6:35 AM
sorry, I think , I have attached the same zip two three times by mistake.
Please remove duplicate attachment if possible or else I will do it, if it is allowed.

Posted by avinash.kumar.vaidhya on 6/29/2011 at 6:30 AM
I tried to add "ConsoleApp.Zip". But it is not showing up in details Attached file section.
I hope it has been submitted & attached.
Posted by MS-Moderator07 on 6/28/2011 at 2:01 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by MS-Moderator01 on 6/28/2011 at 1:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)