1

I have an IntelliSense problem with Nancy and the Razor View Engine.

I try to use the functionality of an (self-made) external library inside my razor view. Therefore I reference the dll and try to put an @using and the namespace on top of the view to get some IntelliSense-Support.

But it doesn't work. The @using can't find the dll or rather the namespace I have to put behind it.

The VS-Error I get is: "The type or namespace name 'type/namespace' could not be found (are you missing a using directive or an assembly reference?)"

It just seems to be an IntelliSense problem because the engine is able to render the view if I use the correct @using on top of the view and ignore the error message or if I have a class inside my project which inherits from IRazorConfiguration and returns the needed namespace.

Notes:

  • Hosting: Self-Host and/or OWIN
  • It works if the library is part of the same solution
  • This happens with with Nancy 0.22.2 as well as 0.23 and the corresponding Razor packages.

Steps to reproduce (or better: things I did):

  • Create a new Console Application
  • Install the Nancy Razor View Engine package
  • Reference an external dll (namespace: External)
  • Reference a dll which is part of the same solution (namespace: Same)
  • Create a new Razor View
  • Try: @using External -> not working
  • Try: @using Same -> working

I hope someone can help me even if It is not a real problem since razor is able to render the view but it's annoying :(

Aje
  • 21
  • 6

1 Answers1

1

OK, I finally found a solution. The following answer led me to it:

https://stackoverflow.com/a/19653760/1761291

I tried it and it worked but instead of doing this its ok to only copy the external dll into the bin folder.

Community
  • 1
  • 1
Aje
  • 21
  • 6