在.NET MVC3剃刀命名空间参考在VB中查看?
问题描述:
我如何引用.NET MVC3命名空间与剃刀视图引擎?
How do I reference a Namespace in .NET MVC3 with the Razor view engine?
我明白这一点可以在C#来完成:
I understand this can be done in C#:
@using Namespace;
然而在VB中这似乎并没有工作:
However in VB this doesn't seem to work:
@Imports Namespace
(我说的是一个.vbhtml文件中)
(i'm talking about inside a .vbhtml file)
答
您正在使用VB正确的语法:
You're using the correct syntax for VB:
@Imports My.Full.Namespace
我在一个快速戏已经找到了解决办法是:
What I've found in a quick play around is:
- 的MVC项目的子命名空间将被智能感知,一旦
@Imports
语句添加回升 - 必须是完整的命名空间 - 如果您正在引用当前MVC项目之外的命名空间,然后将智能感知不把它捡起来,除非你重建。
- Sub namespaces of the MVC project will be picked up by intellisense once the
@Imports
statement is added - must be the complete namespace. - If you're referencing a namespace outside of the current MVC project then intellisense won't pick it up unless you do a rebuild.