构建 Web 部署项目时找不到文件
我有一个 Web 部署项目,用于构建和压缩 Web 应用程序项目。我在构建WDP时遇到很多错误,如下所示:
错误 73 文件“/Foo.csproj/Properties/Administration/Modules/ACL.ascx”不存在。 /Foo.csproj/Properties/Administration/ACL.aspx
错误 74 未知的服务器标记“foo:ACL”。 /Foo.csproj/Properties/Administration/ACL.aspx
这些错误来自 Web 部署项目,而不是 WAP。 错误总是遵循相同的模式,首先是查找 .ascx 时出现错误,然后出现关联错误,表示与先前的 ascx 相关的服务器标记未知(这显然是有道理的)。
ascx 或 aspx 中没有错误或警告。
这些控件是使用 <%@ Register %>
标记注册的(而不是在 web.config 中注册)
什么可能导致这种症状?
< strong>更新
错误来自使用以下命令运行的aspnet_compiler.exe
:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v "/Foo.csproj" -p "C:\Projects\Foo\Foo" -u -f -d obj\Staging \TempBuildDir
和产生以下错误
预编译 ASP.NET 应用程序的实用程序
版权所有 (C) 微软公司。版权所有。 /Foo.csproj/Properties/Administration/ACL.aspx(5):错误 ASPPARSE:文件“/Foo.csproj/Properties/Administration/Modules/ACL.ascx”不存在。
/Foo.csproj/Properties/Administration/ACL.aspx(7): 错误 ASPPARSE: 未知的服务器标记“foo:ACL”。
在 Foo.csproj 中,ACL.aspx 被声明为
<Content Include="Administration\ACL.aspx" />
<!-- Snip -->
<Compile Include="Administration\ACL.aspx.cs">
<DependentUpon>ACL.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\ACL.aspx.designer.cs">
<DependentUpon>ACL.aspx</DependentUpon>
</Compile>
ACL.ascx,因为
<Content Include="Administration\Modules\ACL.ascx" />
<!-- Snip -->
<Compile Include="Administration\Modules\ACL.ascx.cs">
<DependentUpon>ACL.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\Modules\ACL.ascx.designer.cs">
<DependentUpon>ACL.ascx</DependentUpon>
</Compile>
我无法理解路径的 /Properties/
元素来自错误中的路径!它不在项目文件中,也没有被提供给 aspnet_compiler.exe
。
解决方案文件和项目文件与工作解决方案相同(项目名称除外)。
I've got a web deployment project that builds and zips a web application project. I am getting a lot of errors when I build the WDP, as follows:
Error 73 The file '/Foo.csproj/Properties/Administration/Modules/ACL.ascx' does not exist. /Foo.csproj/Properties/Administration/ACL.aspx
Error 74 Unknown server tag 'foo:ACL'. /Foo.csproj/Properties/Administration/ACL.aspx
These errors are coming from the Web Deployment Project, not the WAP.
The errors always follow the same pattern, first there is an error finding the .ascx and then an associated error saying the server tag related to the previous ascx is unknown (this obviously makes sense).
There are no errors or warnings in the ascx or aspx.
The controls are registered using a <%@ Register %>
tag (as opposed to being registered in the web.config)
What could be causing such a symptom?
UPDATE
The errors are coming from aspnet_compiler.exe
which is run with the following command:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v "/Foo.csproj" -p "C:\Projects\Foo\Foo" -u -f -d obj\Staging\TempBuildDir
and produces the following errors
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
/Foo.csproj/Properties/Administration/ACL.aspx(5): error ASPPARSE: The file '/Foo.csproj/Properties/Administration/Modules/ACL.ascx' does not exist.
/Foo.csproj/Properties/Administration/ACL.aspx(7): error ASPPARSE: Unknown server tag 'foo:ACL'.
in Foo.csproj ACL.aspx is declared as
<Content Include="Administration\ACL.aspx" />
<!-- Snip -->
<Compile Include="Administration\ACL.aspx.cs">
<DependentUpon>ACL.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\ACL.aspx.designer.cs">
<DependentUpon>ACL.aspx</DependentUpon>
</Compile>
and ACL.ascx as
<Content Include="Administration\Modules\ACL.ascx" />
<!-- Snip -->
<Compile Include="Administration\Modules\ACL.ascx.cs">
<DependentUpon>ACL.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\Modules\ACL.ascx.designer.cs">
<DependentUpon>ACL.ascx</DependentUpon>
</Compile>
I can't understand where the /Properties/
element of the paths is coming from in the paths in the error ! It's not in project file and it's not being fed to aspnet_compiler.exe
.
The solution file and project files are identical (apart from project names) to a working solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我刚刚在我办公桌上的一个项目中遇到了同样的情况,这是我的解决方案:
错误似乎是非常微妙的
CodeFile
与CodeBehind
I just came across this same situation in a project at my desk, and here was my solution:
The error appears to be the ever subtle
CodeFile
vsCodeBehind
当文件的“构建操作”设置为
None
而不是时,我看到了与此类似的内容(我的记忆确实有点模糊!)内容
。要查看这是否是问题所在:属性
无
将其更正为内容
。另一种可能性是您的
.csproj
中出现了“错误”,因为 ACL.ascx 的路径看起来非常奇怪。它真的应该在/Foo.csproj/Properties/
下吗?如果我的第一个建议没有帮助,我建议尝试以下操作:Foo.csproj
并选择Unload Project
Foo.csproj(不可用)
并选择编辑 Foo.csproj
ACL.ascx
并比较 XML 标记对于该文件到另一个不会生成错误的“好”文件,可能存在导致错误的细微差别I've seen something similar to this (my recollection is admittedly a bit hazy!) when the "Build Action" for the file is set to
None
rather thanContent
. To see if this is the issue:Properties
None
correct it toContent
.The other possibility is that something has gone "wrong" in your
.csproj
as the path to ACL.ascx looks decidedly odd. Should it really be under/Foo.csproj/Properties/
? If my first suggestion isn't helpful, I'd suggest trying the following:Foo.csproj
in Solution Explorer and chooseUnload Project
Foo.csproj (Unavailable)
in Solution Explorer and chooseEdit Foo.csproj
ACL.ascx
and compare the XML markup for that file to another "good" file that isn't generating the error, there' likely a subtle difference there which is causing the error我遇到了类似的错误。
我的情况是这样的:
由于某种原因,有人将 page.aspx 文件复制到 X 文件夹,甚至从我的 Web 应用程序项目中删除该文件,部署项目仍然存在问题。我还注意到,即使使用不同的名称(例如 x 文件夹中的 page.aspx 副本,问题仍然会出现)。
仅当我从 X 文件夹中删除文件 page.aspx (或它的任何名称)时,它才起作用。
I was getting a similar error.
My situation was the following:
for some reason someone copied the page.aspx file to the X folder, and even removing the file from my web application project, the deployment project was still having problems. I also noticed that even with a different name (e.g. copy of page.aspx in the x folder, the problem would still arise).
It only worked when I deleted the file page.aspx (or whatever name it had) from X folder.
就我而言,我通过从
MyFile.aspx
文件中删除CodeFile="MyFile.aspx.cs"
属性解决了该问题。我认为发生错误的原因是CodeFile
属性的优先级高于MyProject.csproj
中的值ASPXCodeBehind
。In my case I have resolved the problem by deleting the
CodeFile="MyFile.aspx.cs"
attribute from theMyFile.aspx
file. I think the error happens because of theCodeFile
attribute has greater priority over the value<SubType>ASPXCodeBehind</SubType>
inMyProject.csproj
.