成员类型不符合 CLS

发布于 2024-08-29 02:18:54 字数 1112 浏览 3 评论 0原文

使用 Visual Studio 2008 和 VB.Net:

我有一个正在运行的 Web 应用程序,它使用 ASMX Web 服务,该服务被编译到其单独的程序集中。我有另一个类库项目编译为单独的程序集,用作此 Web 服务的代理。这一切似乎在运行时都有效,但我在编译时收到此警告,我不明白并想修复:

成员“wsZipee”的类型不符合 CLS

我有几十个主项目中的 Web 表单引用代理类,没有编译时间投诉,如以下代码片段所示:

Imports System.Data
Partial Class frmZipeee
    Inherits System.Web.UI.Page

    Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
    Dim dsStandardMsg As DataSet

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
          Handles MyBase.Load

然而我有一个 Web 表单(也在主项目的根目录中),它给了我“不符合 CLS ”的消息,但还尝试就像其他 ASPX 文件一样引用代理类。我在我用“错误”注释的行上收到编译时警告。

Imports System.Data
Partial Class frmHome
    Inherits System.Web.UI.Page

    Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee   ERROR here 
    Dim dsStandardMsg As DataSet

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
         Handles MyBase.Load

这对我来说毫无意义。带有警告的文件名为frmHome.aspx.vb;项目中的所有其他人都以同样的方式声明事情并且没有任何警告。顺便说一句,Web 服务本身返回标准数据类型:整数、字符串和数据集。

Using Visual Studio 2008 and VB.Net:

I have a working web app that uses an ASMX web service which is compiled into its separate assembly. I have another class library project compiled as a separate assembly that serves as a proxy to this web service. This all seems to work at runtime but I am getting this warning at compile time which I don't understand and would like to fix:

Type of member 'wsZipeee' is not CLS-compliant

I have dozens of webforms in the main project that reference the proxy class with no compile time complaints as this snippet shows:

Imports System.Data
Partial Class frmZipeee
    Inherits System.Web.UI.Page

    Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
    Dim dsStandardMsg As DataSet

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
          Handles MyBase.Load

And yet I have one webform (also in the root of the main project) which gives me the "not CLS-compliant" message but yet attempts to reference the proxy class just like the other ASPX files. I get the compile time warning on the line annoted by me with 'ERROR here..

Imports System.Data
Partial Class frmHome
    Inherits System.Web.UI.Page

    Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee   ERROR here 
    Dim dsStandardMsg As DataSet

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
         Handles MyBase.Load

This makes no sense to me. The file with the warning is called frmHome.aspx.vb; all others in the project declare things the same way and have no warning. BTW, the webservice itself returns standard datatypes: integer, string, and dataset.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铁轨上的流浪者 2024-09-05 02:18:54

我使用 Codebehind 将此问题追溯到“问题”文件的 <%@ Page 声明,而其他文件则使用 CodeFile 属性。当我更改它时,它引发了一些新问题,但我解决了这些问题,从而使最初关于不符合 CLS 的投诉消失了。

I traced this problem to the <%@ Page declarative of the "problem" file using Codebehind while the other file(s) used the CodeFile attribute. When I changed it, it triggered some new issues but I solved them and in turn the original complaint about nonCLScompliance went away.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文