ASP.Net的VirtualPathProvider和Visual Studio的智能感知 [英] ASP.Net VirtualPathProvider and Visual Studio Intellisense

查看:124
本文介绍了ASP.Net的VirtualPathProvider和Visual Studio的智能感知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能帮助我这个烦恼。

I'm hoping someone can help me out with this annoyance.

目前工作中,我们有具有共同母版两个独立的网站的项目。母版嵌入在一个类库,这两个项目的参考。我们使用自定义的VirtualPathProvider,让我们引用母版中的每个项目。这在运行时/编译时工作正常,但它的aspx页面的标记内智能感知打破。

At work we have two independent website projects that share a common MasterPage. The MasterPage is embedded in a class library that both projects reference. We use a custom VirtualPathProvider that lets us reference the MasterPage in each project. This works fine at runtime/compiletime, but it breaks intellisense inside the aspx page markup.

当我设置的MasterPageFile属性为〜/ EmbeddedMasterPage.Master,Visual Studio中显示其下一个红色的squiggley错误说找不到路径,与目录,表明它试图找到网站项目中的文件(相对于类库项目)。由于Visual Studio无法揣摩出母版,它是造成所有的智能感知的突破。它不会显示标签什么。事实上,它会给我唯一的智能感知是基础html标签。从谷歌搜索的时候,我唯一能找到的信息是VS找不到嵌入的母版的根HTML /头/ body标签。我无法找到一个方法来解决它,但。

When I set the MasterPageFile property to "~/EmbeddedMasterPage.Master", Visual Studio shows a red squiggley error under it saying "Path not found", with a directory indicating that it's trying to find that file inside the website project(as opposed to the class library project). Since Visual Studio can't figure out where the MasterPage is, it's causing all of the intellisense to break. It won't show anything for the tags. In fact, the only intellisense it will give me is for basic html tags. From Googling around, the only information I could find is that VS can't find the root html/head/body tags in the embedded MasterPage. I couldn't find a way to fix it, though.

这发生在两个Visual Studio 2008和2010年。

This happens in both Visual Studio 2008 and 2010.

更新(2011年4月10日)

有关目前,我有到嵌入式母版复制到现场实际项目,以获得它的工作。我设置的文件,不编译/复制和它的作品了正常。

For the time being, I'm having to copy the embedded masterpage to the actual site project in order to get it to work. I set the file to not compile/copy and it works out ok.

推荐答案

在的VirtualPathProvider需要运行时环境。在设计时,这是不可用,所以没有办法让IDE通过的VirtualPathProvider找到它。

The VirtualPathProvider requires the run-time environment. During design time this is not available, so there is no way to get the IDE to find it via VirtualPathProvider.

我觉得你的更新是最好的解决办法。

I think your update is the best workaround.

这篇关于ASP.Net的VirtualPathProvider和Visual Studio的智能感知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆