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

Notification

Icon
Error

NCrunch and RazorGenerator.MsBuild
djanosik
#1 Posted : Monday, January 27, 2014 1:42:41 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/5/2013(UTC)
Posts: 2
Location: Czech Republic

Thanks: 1 times
Hi,

I use RazorGenerator.MsBuild to precompile Razor views in my application. The main project will not compile with NCrunch (2.x). The following exception is thrown:
Quote:
The "RazorCodeGen" task could not be loaded from the assembly... Could not load file or assembly...

I can fix this by specifying additional files to include (packages\RazorGenerator.MsBuild.2.2.2\tools\**.*). The assembly is correctly loaded, but there are some errors in precompiled views.
Quote:
The type or namespace name 'TypeFromReferencedProject' could not be found (are you missing a using directive or assembly reference?)

I am not able to fix this. Can you help me?

Thank you!

Dusan
Remco
#2 Posted : Monday, January 27, 2014 11:12:39 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Dusan -

Thanks for posting!

Most likely the precompiler requires that referenced assemblies exist in the output directory of the web application's DLL file. You can fix this by turning on the 'Copy referenced assemblies to workspace' project-level configuration setting for all the projects involved.

Note that this will incur a fairly significant performance penalty when building your project. You may want to weigh up the value of the precompiler when working with NCrunch - it may be worth disabling it for NCrunch builds by making the RazorGenerator build task conditional on NCrunch not being responsible for the build.
1 user thanked Remco for this useful post.
djanosik on 1/28/2014(UTC)
djanosik
#3 Posted : Tuesday, January 28, 2014 8:20:35 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/5/2013(UTC)
Posts: 2
Location: Czech Republic

Thanks: 1 times
Thank you! It works now.
Remco
#4 Posted : Tuesday, January 28, 2014 11:13:32 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Excellent. Thanks!
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