jeudi 26 juillet 2018

Error scaning the types in an assembly when a webservice reference is added to hte project

I have this code:

public void Initialize()
    {
        if (Configuration["Integration:Client:" + OrdersIntegrationConstants.ExternalLoadFieldsType] != null && !String.IsNullOrEmpty(Configuration["Integration:Client:" + OrdersIntegrationConstants.ExternalLoadFieldsType].ToString()))
        {
            var kk1 = Configuration["Integration:Client:" + OrdersIntegrationConstants.ProjectDirectory].ToString();
            var kk2 = Assembly.LoadFrom(kk1);

            Type[] typesInAsm;
            try
            {
                typesInAsm = kk2.GetTypes();

                var kk4 = typesInAsm.ToList();

            }
            catch (ReflectionTypeLoadException ex)
            {
                typesInAsm = ex.Types;
            }

        }
    } 

When adding a reference in the project (of the dll) to a windowsservice(asmx) I get an error with the text: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

When I remove the reference to the web service it works ok: enter image description here





Aucun commentaire:

Enregistrer un commentaire