DEV 看起来很棒,在 Staging 和 PROD 上我收到 CS1061 错误(“ASP.B”不包含“Prop1”的定义)
我有使用另一个 Web 用户控件 B 的 Web 用户控件 A。AI 内部有:
<prefixABC:b ... Prop1="value" />
此 prop1 是 B.ascx 上定义的公共属性:
<script runat="server">
...
public string Prop1 { get; set; }
...
</script>
注意:我知道我不应该在 ascx 文件内使用代码,但它是内部的要求:/
我也有不同的环境:开发、暂存、生产。它们基本上是相同的(不相同,但非常相似)。事情在开发上工作正常,但在登台和生产时我收到此错误消息:
异常类型:HttpParseException 异常消息:d:...\A.ascx(6):错误 CS1061:“ASP.B”不包含“Prop1”的定义,并且没有扩展方法“Prop1”接受类型为“ASP.B”的第一个参数' 可以找到(您是否缺少 using 指令或程序集引用?)
我 100% 确定代码在所有环境中都是相同的。谁能告诉我可能是什么原因导致这个问题?
I have web user control A that uses another web user control B. Inside A I have:
<prefixABC:b ... Prop1="value" />
This prop1 is a public property defined on B.ascx:
<script runat="server">
...
public string Prop1 { get; set; }
...
</script>
Note: I know I wasn't supposed to be using code inside ascx file but it's an internal requirement :/
I also have different environments: dev, staging, prod. They are basically the same (not identical, but very similar). The thing is on dev it works fine, but on staging and prod I am getting this error message:
Exception type: HttpParseException
Exception message: d:...\A.ascx(6): error CS1061: 'ASP.B' does not contain a definition for 'Prop1' and no extension method 'Prop1' accepting a first argument of type 'ASP.B' could be found (are you missing a using directive or an assembly reference?)
I am 100% sure that the code is the same on all environments. Could anyone tell me what might be causing this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我明白问题出在哪里了。我无法访问 PROD 环境,因此我不知道那里有哪些文件。问题是,在同一文件夹结构(实际上是几个文件夹)内有一个控件 B 的版本,该版本不应该存在,并且与正确的版本冲突。当我把它取下来时,事情开始顺利进行。
I figured it out what the problem was. I didn't have access to the PROD environment so I didn't know what files were there. The thing is there was a version of the control B inside the same folder structure (a couple folders up actually) that wasn't supposed to be there and that was conflicting with the correct one. When I removed it, things started working beautifully.