在此上下文中不可访问,因为它是朋友
Is not accessible in this context because it is friend
我从另一个 C# 项目中提取了一些代码并将其转换为 vb 但现在出现错误:
Is not accessible in this context because it is friend
Imports System.Security.Cryptography
Public Shared Sub Sign()
CryptoConfig.AddAlgorithm(GetType(RSAPKCS1SHA256SignatureDescription), "http://www.w3.org/2000/09/xmldsig-more#rsa-sha256")
End Sub
要求的namespace是System.Deployment.Internal.CodeSigning
但是这个命名空间好像没有RSAPKCS1SHA256SignatureDescription
.
正在导入的命名空间是 System.Security.Cryptography
,但我开始认为这是从错误的库派生的。
Imports System.Security.Cryptography
Namespace System.Security.Cryptography
Friend Class RSAPKCS1SHA256SignatureDescription
Inherits RSAPKCS1SignatureDescription
Public Sub New()
End Class
End Namespace
任何人都可以深入了解此错误消息吗?
此错误似乎与 Microsoft 所说的不符:
错误 ID:BC30389
https://docs.microsoft.com/en-us/dotnet/visual-basic/misc/bc30389
请注意错误消息是如何引用 System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription
的?那就是您的代码所引用的 class 并且 class 被声明为 Friend
,因此这就是您不能使用它的原因。如果您想要 System.Deployment.Internal.CodeSigning.RSAPKCS1SHA256SignatureDescription
class 那么这就是您需要导入的命名空间。
首先需要将 System.Deployment
命名空间添加到您的项目中,以便引用 Internal.CodeSigning
库。
我从另一个 C# 项目中提取了一些代码并将其转换为 vb 但现在出现错误:
Is not accessible in this context because it is friend
Imports System.Security.Cryptography
Public Shared Sub Sign()
CryptoConfig.AddAlgorithm(GetType(RSAPKCS1SHA256SignatureDescription), "http://www.w3.org/2000/09/xmldsig-more#rsa-sha256")
End Sub
要求的namespace是System.Deployment.Internal.CodeSigning
但是这个命名空间好像没有RSAPKCS1SHA256SignatureDescription
.
正在导入的命名空间是 System.Security.Cryptography
,但我开始认为这是从错误的库派生的。
Imports System.Security.Cryptography
Namespace System.Security.Cryptography
Friend Class RSAPKCS1SHA256SignatureDescription
Inherits RSAPKCS1SignatureDescription
Public Sub New()
End Class
End Namespace
任何人都可以深入了解此错误消息吗?
此错误似乎与 Microsoft 所说的不符:
错误 ID:BC30389
https://docs.microsoft.com/en-us/dotnet/visual-basic/misc/bc30389
请注意错误消息是如何引用 System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription
的?那就是您的代码所引用的 class 并且 class 被声明为 Friend
,因此这就是您不能使用它的原因。如果您想要 System.Deployment.Internal.CodeSigning.RSAPKCS1SHA256SignatureDescription
class 那么这就是您需要导入的命名空间。
首先需要将 System.Deployment
命名空间添加到您的项目中,以便引用 Internal.CodeSigning
库。