Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table Driven Menus
Message
De
21/11/2009 08:12:07
 
 
À
21/11/2009 00:09:20
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01435073
Message ID:
01435928
Vues:
35
>>I hope I have explained the problem. Am I doing something wrong or what is it?
>
>Bernard,
>
>Part of the problem is that the MyReflectionClass that was posted in my blog makes a few assumptions ... and I *did* mention in that post that you'd probably want to do something for paths to your assembly. Here's the comment from my blog:
>
>
>/// Make sure that you have either included the full path to your Assembly file    
>/// or that you modify this class to include code for obtaining the full path.    
>/// This full-path could be a local path, or a server URL path. 
>
>
>But I guess I missed the fact that including the path in the actual Assembly name causes problems and that only the second suggestion in the comment above will work correctly (modify to include code for obtaining the full path). I mentioned in the post that this is a simplified version of my real class. In taking out the part for getting paths, I inadvertantly slipped a bug in there. Now, to be fair, I *did* test this ... but, did *not* test it with any sort of path (because in my tests, everything lived in MyApp\bin\debug).
>
>So my bad. Sorry to put you through all that turmoil. =0( My real class has this little bit added to it, which makes all the difference in the world:
>
>
>public Assembly LoadAssembly(ref string Message)    
>{
>        Assembly oAssembly = null;
>        try
>        {
>            // in my Framework, I have configuration classes that handles this sort of thing
>            // for your testing, you could add another property to the class
>            string PathOrURL = MethodToObtainPathOrURL();
>            oAssembly = Assembly.LoadFrom(PathOrURL + this.m_AssemblyName + ".DLL");
>        }   
>  // rest of method
>}   
>
>
>So, in reality, you do NOT want to pass in the entire path of the Assembly, only the actual Assembly file name, SimpleClassLibrary1 in your case.
>
>I'll update my blog to reflect this. Again, I apologize for all the time you've wasted with this!!!! I have a friend who lives in Brisbane ... next time I visit him, I'll buy you a Fosters! <g> (I've actually never visited him, and probably won't any time in the foreseeable future ... but you can always hope <g>).
>
>~~Bonnie

Hi Bonnie

Yes that Foster's sounds good :)

Anyway did I mention that I am new to all this .Net stuff?

The question I now have is this line:
string PathOrURL = MethodToObtainPathOrURL();
Lets say I do have this method MethodToObtainPathOrURL()

So if I did have this method and it ran, what *exactly* will be the string it returns to the variable PathOrURL if my DLL is in this path:
c:\vs2008\Myprojects\SimpleClassProject\bin\SimpleClass1.dll
The reason I ask is I want to test this code out to see it working before I investigate creating a method like MethodToObtainPathOrURL()

So I will hardcode the path into the variable PathOrURL just so I can test the rest of the code first and if it works will look further about obtaining the path in a method.

So

Q. What will be the string value of PathOrURL for the above path to the DLL?

*Update:*

Bonnie

I have got it working. I see now how the problem was in the properties.set method that added the full path to the class as well. Anyway the good news is that it is now working with hardcoded paths and values but these can easily come from fields in a table.

It has been a long road with much frustration for me but with your patient help I have succeeded.

Thank you for your time & patience. Now I will explore making the class more generic so that the app can be more flexible.

Maybe I can buy you that Fosters instead except I drink XXXX (pronunced Four X) which is locally brewed.

Cheers

Bernard
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform