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

Notification

Icon
Error

NCrunch Build fails when building MVC views
simonl
#1 Posted : Wednesday, November 16, 2011 12:34:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/16/2011(UTC)
Posts: 2

Was thanked: 1 time(s) in 1 post(s)
The build fails if an MVC web project is set to build views, and a view references a dependency in a project reference.

To recreate:
Create a new MVC 3 project, called MvcApplication1
Create a new ClassLibrary project, called ClassLibrary1
Add a project reference to ClassLibrary1 from MvcApplication1
Enable NCrunch
Edit MvcApplication1.csproj to change the line:
<MvcBuildViews>false</MvcBuildViews>
to
<MvcBuildViews>true</MvcBuildViews>
(at this point it should still be building)
Edit \Views\Home\Index.cshtml, adding the line @using ClassLibrary1 at the top of the view.

NCrunch build now fails with@
c:\Users\XXXXX\AppData\Local\NCrunch\8528\15\MvcApplication1\Views\Home\Index.cshtml (2): The type or namespace name 'ClassLibrary1' could not be found (are you missing a using directive or an assembly reference?)

My guess is that something funny is going on with the aspnet_compiler not finding the project dependency.

Any way of fixing this?

Thanks,
Simon.
Remco
#2 Posted : Wednesday, November 16, 2011 10:20:17 PM(UTC)
Rank: NCrunch Developer

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

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

Thanks for reporting this. It looks as though the MVC web compiler is expecting the dependencies to be in the same directory as the web project at build time. You should be able to solve this issue by turning on the CopyReferencedAssembliesToWorkspace for your web project. I'll make a note to adjust a future revision of NCrunch to do this automatically so it's a bit less confusing.


Cheers,

Remco
simonl
#3 Posted : Thursday, November 17, 2011 9:07:14 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/16/2011(UTC)
Posts: 2

Was thanked: 1 time(s) in 1 post(s)
Great thanks Remco, that has fixed the problem. Sorry, I had spotted that option earlier but forgot to try it!

Cheers for the quick response.

Simon.
1 user thanked simonl for this useful post.
Remco on 11/17/2011(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.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download