Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor Helper in MVC 3 RC

I get an error when using razor helpers in an MVC 3 project (did put the cshtml file in app_code). Looks like the generated code is using a wrong assembly reference.

using WebMatrix.Data;
using WebMatrix.WebData;

Compiler says:

CS0246: The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?)

Putting them into GAC did not change anything. Am I not getting it? Or is this a bug? Any ideas?

like image 312
mbr Avatar asked Nov 10 '10 16:11

mbr


2 Answers

You need to add a reference to the DLL in Web.config.

like image 122
SLaks Avatar answered Oct 05 '22 08:10

SLaks


mbr, we are aware of the issue and plan on addressing it for RTM. You could either add references to the WebMatrix assemblies like SLaks suggested or (and I think this is better) simply add those 2 namespaces to your project by adding the following code:

namespace WebMatrix.Data { internal class Ignore { } }
namespace WebMatrix.WebData { internal class Ignore { } }
like image 24
marcind Avatar answered Oct 05 '22 08:10

marcind