Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Build failure only in ncrunch - GAC ?
itto5
#1 Posted : Wednesday, January 14, 2015 3:03:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/14/2015(UTC)
Posts: 2
Location: Belgium

Was thanked: 1 time(s) in 1 post(s)
Hi,

When I try to build my project with NCrunch, I keep getting problems like the following:

Quote:
"The type 'Microsoft.Web.Administration.ServerManager' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.9.0.0__31bf3856ad364e35\Microsoft.Web.Administration.dll' and 'e:\_SourceControl\framework\packages\Microsoft.Web.Administration.7.0.0.0\lib\net20\Microsoft.Web.Administration.dll


When I build using VS2013 or just through msbuild.exe, the build just runs fine. Other projects in the solution also just work with ncrunch.

I've been spending hours looking for a solution to this, so any ideas would be most welcome.

Kind regards,
Kristof
Remco
#2 Posted : Wednesday, January 14, 2015 10:00:37 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Kristof,

Thanks for sharing this issue.

Is it possible you are making use of two different versions of the same DLL referenced within the same project space? Sometimes this can happen if:

Project A references Project B
Project A references Microsoft.Web.Administration (v7.0)
Project B references Microsoft.Web.Administration (v7.9)

I've found that MSBuild can be quite inconsistent in the way it handles these situations, depending upon how the references are structured within the solution. NCrunch does make some changes to references in order to set up workspaces for the projects when it builds them, so it's quite likely that this change in conditions is causing the error to surface where it isn't surfacing for your normal VS builds. Unfortunately trying to get NCrunch to work in exactly the same way as a foreground VS build isn't possible, so the solution here would be trying to find the mismatched references and correct them. Assemblies that manage to successfully build with reference mismatches can encounter runtime problems, so this is something you will want to sort out regardless of your use of NCrunch.

I'd suggest doing a full text search on your codebase for "Microsoft.Web.Administration". The references should be declared inside your project XML. Make sure that when you reference this DLL, you do so using its correct strong name. MSBuild and the CLR will both resort to the GAC installed version of a strongly named assembly before searching other locations - so make sure that the declarations of these references are consistent throughout your solution.

Cheers,

Remco
itto5
#3 Posted : Friday, January 16, 2015 8:22:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/14/2015(UTC)
Posts: 2
Location: Belgium

Was thanked: 1 time(s) in 1 post(s)
That did it, thank you very much!

I changed references from

Quote:
<Reference Include="Microsoft.Web.Administration">


to

Quote:
<Reference Include="Microsoft.Web.Administration, version=7.0.0.0">


and it immediately worked.
1 user thanked itto5 for this useful post.
Remco on 1/16/2015(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.033 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download