当我尝试在脚本任务中使用它时,为什么AesCryptoServiceProvider类不显示? [英] Why doesn't the AesCryptoServiceProvider class show up when I try to use it in a script task?

查看:105
本文介绍了当我尝试在脚本任务中使用它时,为什么AesCryptoServiceProvider类不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将System.Security.Cryptography.AesCryptoServiceProvider类导入到SQL Server 2008 SSIS包的脚本任务中。



当我查看使用脚本任务对象资源管理器的可用命名空间,AesCryptoServiceProvider类可用,如此屏幕截图所示:



http://i.imgur.com/hZKoj5u.png



当我尝试将其导入我的代码,它不可用。



http:// i。 imgur.com/Ob7wID1.png



这种情况​​发生在我的工作站上只安装了.Net 4.0,所以我安装了4.5并且AesCryptoServiceProvider类是仍然没有。



我缺少什么?

I am trying to import the System.Security.Cryptography.AesCryptoServiceProvider class into a script task of a SQL Server 2008 SSIS package.

When I look at the available namespaces with the script task object explorer, the AesCryptoServiceProvider class is available, as can be seen in this screen shot:

http://i.imgur.com/hZKoj5u.png

When I try to import it into my code, it is not available.

http://i.imgur.com/Ob7wID1.png

This happened when I only had .Net 4.0 installed on my workstation, so I installed 4.5 and the AesCryptoServiceProvider class is still not available.

What am I missing?

推荐答案

确保参考System.Core是添加。在解决方案资源管理器中检查项目的参考。您的第一个图像不能证明它已完成,它只是显示命名空间系统下的可用内容,但它与您的项目无关。但是,你的第二张图片表明你所需要的课程可以被你的项目引用,否则Intellisense不会显示图片上显示的课程。



一般来说,你的显示问题的方法不是很好。您应该更好地编写您想要编写的内容(至少只需要提供正确语法所需的类,只需要一个变量或成员声明就足够了)并将项目传递给编译器,然后查看错误消息。



我希望你明白命名空间与.NET模块化无关,只有程序集和参考它们。而使用仅仅有助于缩短代码中的顶级类型名称,而不是其他。



-SA
Make sure the reference System.Core is added. Check up your project's References in Solution Explorer. You first image does not proof that it's done, it simply shows what's available under the namespace "System", but it is not related to your project. However, your second image suggests that the class you need can be referenced by your project, otherwise Intellisense wouldn't show the classes shown on the picture.

Generally, your approach to showing the problem is not very good. You should better write what you wanted to write (to some minimum, just mention the class you need with correct syntax, having just a variable or member declaration would be enough) and pass the project to a compiler, and then look at error messages.

I hope you understand that namespace have nothing to do with .NET modularity, only assemblies and referencing of them do. And "using" merely helps to shorten top-level type names in code, nothing else.

—SA


这篇关于当我尝试在脚本任务中使用它时,为什么AesCryptoServiceProvider类不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆