1

在 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 建议“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 并产生与我删除物理路径时相同的问题......它似乎正在构建其他站点之一。

4

0 回答 0