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

Notification

Icon
Error

Build errors when referencing Shared Projects
distilled
#1 Posted : Thursday, April 6, 2017 4:03:42 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/3/2012(UTC)
Posts: 22

Thanks: 2 times
Was thanked: 6 time(s) in 6 post(s)
I'm currently working on a solution that contains a Shared Project (*.shproj). The shared project is referenced by two class library projects. NCrunch (v3.6.0.2) raises the following error if I don't tell it to ignore the shared project:

Code:

NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\CodeSharing\Microsoft.SharedProject.Common.targets (15, 5): Shared projects cannot be built on their own.  Please either build a project that references this project, or build the entire solution.


If I set "Ignore this project completely" to "true" in my NCrunch configuration then changes to the files in the shared project aren't detected properly. For example, if I add a new class named "Foo" to the shared project, NCrunch raises the following error in both class library projects that depend on it:

Code:

CSC (0, 0): Source file '%LOCALAPPDATA%\NCrunch\9804\10\src\SharedProject\Foo.cs' could not be found.


I've tried adding the shared project's directory to the list of "Additional files to include" for the solution, but I still receive the above error when adding new files to the shared project. Is there anything else I can do to support this scenario?

Remco
#2 Posted : Thursday, April 6, 2017 11:44:37 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 960 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

Shared projects are still a work in progress, so there are some rough edges here. Standard practice at the moment is to always ignore the shared project. The projects that then reference it should have all 'shared' files explicitly included and things should work. Because NCrunch doesn't track the in-memory changes to shared projects, you'll need to save these to disk and reload the referencing projects before they pick up the changes. There shouldn't be any need to make use of the 'Additional files to include' setting here.
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download