开发者

Adventures on Enterprise Library 5.0: Who moved my cheese (namespace)

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开发者_StackOverflow中文版 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜