如何在 Web 参考中处理 CLS 兼容问题?
-
16-09-2019 - |
题
我正在打开[程序集:System.CLSCompliant(true)] 在我的 C# 解决方案的程序集中。
我现在在为 SharePoint Web 服务生成的代码中收到一些警告。
以下是不符合 CLS 的方法之一:
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetItem", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public uint GetItem(string Url, out FieldInformation[] Fields, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] out byte[] Stream) {
object[] results = this.Invoke("GetItem", new object[] {
Url});
Fields = ((FieldInformation[])(results[1]));
Stream = ((byte[])(results[2]));
return ((uint)(results[0]));
}
我怎样才能删除这个警告?
谢谢,基思
解决方案
我建议你将在未设置为符合CLS的一个单独的类库项目中的Web引用。从主代码引用该库。
不隶属于 StackOverflow