Enterprise Library 5.0历险记:谁动了我的奶酪(命名空间)

发布于 2024-09-04 10:34:02 字数 1412 浏览 7 评论 0原文

耶稣、克里希纳、佛陀!

我已迁移到 EntLib 5.0,但像 ISymmetricCryptoProvider 这样的类不再被识别。有趣的是,数据、日志记录和其他块都可以正常编译。

这是有问题的类:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;//-->it's not working anymore
using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;//-->it's not working anymore

namespace MyClassLibrary.Security.EnterpriseLibrary
{

    public sealed class Crypto
    {

        public static ISymmetricCryptoProvider MyProvider
        {
            get 
            {
                //IConfigurationSource is not recognized either, neither SystemConfigurationSource
                IConfigurationSource cs = new SystemConfigurationSource();
                SymmetricCryptoProviderFactory scpf = new SymmetricCryptoProviderFactory(cs);
                ISymmetricCryptoProvider p = scpf.CreateDefault();
                return p; 
            }
        }

项目上的参考文献也很好。我真的不知道为什么这个特定的项目在 VS2010 上造成了太多麻烦!旧的引用被删除,项目被清理,重建,但无法编译:-(

引用是:

Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Logging
Microsoft.Practices.EnterpriseLibrary.Logging.Database
Microsoft.Practices.EnterpriseLibrary.Security
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography

为什么有些名称空间可以找到,而其他名称空间却找不到?

Jesus, Krishna, Budda!

I've migrated to EntLib 5.0, but classes like ISymmetricCryptoProvider are not recognized anymore. Funny to say that Data, Logging and other blocks are working compiling fine.

Here's the problematic class:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;//-->it's not working anymore
using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;//-->it's not working anymore

namespace MyClassLibrary.Security.EnterpriseLibrary
{

    public sealed class Crypto
    {

        public static ISymmetricCryptoProvider MyProvider
        {
            get 
            {
                //IConfigurationSource is not recognized either, neither SystemConfigurationSource
                IConfigurationSource cs = new SystemConfigurationSource();
                SymmetricCryptoProviderFactory scpf = new SymmetricCryptoProviderFactory(cs);
                ISymmetricCryptoProvider p = scpf.CreateDefault();
                return p; 
            }
        }

The references are fine on project too. I really don't know why this particular project it's causing too many trouble on VS2010! Older references were deleted, project was cleaned, rebuilt, but can't make it compile :-(

The references are:

Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Logging
Microsoft.Practices.EnterpriseLibrary.Logging.Database
Microsoft.Practices.EnterpriseLibrary.Security
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography

Why some namespaces can be found while others can't?

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

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

发布评论

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

评论(2

南汐寒笙箫 2024-09-11 10:34:02

根据您拥有的 4.1 引用,您仍然引用 Enterprise Library 4.1 程序集。您需要删除这些引用并添加对 Enterprise Library 5.0 程序集的引用。

加密块应该可以按原样使用,而无需更改代码。还要确保更新所有配置文件中的“引用”。

Based on the 4.1 references that you have, you are still referencing the Enterprise Library 4.1 assemblies. You need to remove those references and add references to the Enterprise Library 5.0 assemblies.

The cryptography block should be usable as is without changing your code. Also make sure to update the "references" in all of your configuration files.

怀里藏娇 2024-09-11 10:34:02

构建时共享命令行(输出窗口、csc.exe 命令行以及所有 -r 以查看编译器的引用)?它可能会提示问题。

Share the command-line when building (output window, csc.exe command line with all the -r's to see what references are going to the compiler)? It might suggest the problem.

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