aspnet_compiler可以看到虚拟子目录吗?

时间:2011-07-26 01:22:05

标签: asp.net iis aspnet-compiler

在IIS中,我的网站有一个虚拟目录,位于端口87,指向sites\MySiteName\。站点中还有一个指向sites\otherSite\otherControls的虚拟子目录。

以下是解决方案文件websites.sln的摘录,其中包含我的网站:

"Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "MySiteName", "http://localhost:87", "{5B52E21D-C089-4DCD-A7CA-8B0B70D43544}"
    ProjectSection(WebsiteProperties) = preProject
        UseIISExpress = "false"
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
        Debug.AspNetCompiler.VirtualPath = "/LM/W3SVC/2"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\MySiteName\"
        Debug.AspNetCompiler.PhysicalPath = "..\..\..\Sites\MySiteName\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "true"
        Debug.AspNetCompiler.Debug = "True"
        SlnRelativePath = "..\..\..\Sites\MySiteName\"

当我实际访问该网站时,这工作正常。当我在项目websites.sln(包含我的网站)上运行msbuild时,它会尽职尽责地创建一个元项目并尝试构建。一切顺利,直到它尝试构建一个引用虚拟子目录中的控件的文件。

ASPPARSE: The file '/LM/W3SVC/2/otherControls/control.ascx' does not exist. in \LM\W3SVC\2\file.aspx

cognethos suggests“ASP编译器现在知道根文件夹的安装位置,但是由于指定了物理文件夹,它只能在该文件夹中查找,因此找不到其他虚拟文件夹。”

建议的解决方案是忽略物理路径。当我这样做时,它似乎不再构建MySiteName,而是发出明显来自其他网站的警告。

我尝试省略物理路径和虚拟路径并改为使用MetabasePath:

Debug.AspNetCompiler.MetabasePath = "LM/W3SVC/2"

这会产生没有希望的错误

C:\BUILD\MySiteName.metaproj : error MSB3462: Either MetabasePath or VirtualPath must be specified.

我不清楚为什么它不能识别我给它的MetabasePath。我尝试完全使用msbuild跳转并直接将aspnet_compiler指向该站点,仅使用MetabasePath并且与我删除物理路径时出现相同的问题......它似乎正在构建其他站点之一

0 个答案:

没有答案