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



Issue with linking to libraries which aren't built by solution and aren't in GAC
#1 Posted : Thursday, November 10, 2011 5:25:42 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 43
Location: Chicago, IL

Thanks: 2 times
Was thanked: 7 time(s) in 6 post(s)
I'm seeing an issue where Ncrunch doesn't appear to be handling referenced libraries that aren't in the GAC and aren't part of the solution itself. Details below:

Solution folder structure: (I've modified the names so as not to get in trouble with my employer)

. Trunk
. |- MySolution.sln
. |- Src
. | |- Project1Folder (With Project1.csproj)
. | |- Project2Folder
. | `- ProjectNFolder
. | |-Debug
. | `- Release
. |- Lib
. `- Bin
. |- Debug
. `- Release

Solution has multiple projects, where Project1 has a project reference to Project2 and ProjectN, etc. In many cases, projects also have references to .dlls in the Lib folder which are not build by the solution and which are not in the GAC. For example, the nUnit binaries may be in the Lib folder, and ProjectN would reference by file the nunit.dll in Lib. The projects are configured to place their outputs in the Trunck/Bin folder.

Here's an example of the lines in the .csproj file:

. <ItemGroup>
. <Reference Include="Some.ThirdParty.Library, Version=, Culture=neutral, PublicKeyToken=xxxxx, processorArchitecture=MSIL">
. <SpecificVersion>False</SpecificVersion>
. <HintPath>..\..\..\Lib\$(Configuration)\Some.ThirdParty.Library.dll</HintPath>
. </Reference>

What I'm seeing is that Ncrunch is able to compile the project, but is running into some issue post-compile. Specifically, the Ncrunch Tests window shows a red X beside the project name, with this error message:

NCrunch: If you are experiencing problems in getting this project to build, have a look at http://wiki.ncrunch.net/...oting-build-issues.ashx

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (3341): Cannot register assembly "C:\Users\wrij01\AppData\Local\NCrunch\8424\11\Bin\Debug\Project1.dll". Could not load file or assembly 'Some.ThirdParty.Library, Version=, Culture=neutral, PublicKeyToken=xxxxx' or one of its dependencies. The system cannot find the file specified.

When I look in the referenced folders, I see the Some.ThirdParty.Library.dll in the obj file, but not in the bin folder.

. C:\Users\wrij01\AppData\Local\NCrunch\8424\11
. |- Bin
. | `- Debug
. | |- MyProject1.dll
. | |- MyProject1.pdb
. | `- MyProject1.xml
. `- Src
. `- Project1Folder
. |- obj
. | `- Debug
. | |- Some.ThirdParty.Library.dll
. | `- <other files you'd expect to see in the obj folder>
. `- <full project source tree>

Please let me know if I can provide additional information. If needed, I can try to create a sample VS solution and project that to you.
#2 Posted : Thursday, November 10, 2011 5:29:26 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 43
Location: Chicago, IL

Thanks: 2 times
Was thanked: 7 time(s) in 6 post(s)
hmm. The forum doesn't like my use of spaces in the folder tree diagrams. If this isn't readable, let me know and I'll try a different approach.
#3 Posted : Thursday, November 10, 2011 9:36:23 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 622 times
Was thanked: 725 time(s) in 690 post(s)
It looks as though the COM registration step for your output assembly is unable to deal with NCrunch's workspace build wiring. My guess would be that the UnmanagedRegistration step doesn't consider the same workflow for assembly resolution as other areas of MSBuild, or this may be something to do with the setup of your project file. Does the .csproj file in your NCrunch workspace contain any relative references to the problematic assemblies (other than the usual <Reference> tags)?

One thing that may solve this problem is if you add a reference to the contents of the Lib folder using the AdditionalFilesToInclude setting (i.e. '..\..\..\Lib\**.*').

Another option may be to disable the COM registration build step for NCrunch builds only. You can try this using the $(NCrunch) build property in your .proj file on the RegisterForComInterop setting, for example:

<RegisterForComInterop Condition=" '$(NCrunch)'=='1' ">true</RegisterForComInterop>

Users browsing this topic
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.038 seconds.