Salut,
j'ai crée une class library toute simple:
Code :
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace ClassLibrary1
- {
- public class Class1
- {
- public int ReturnSomething()
- {
- return 1;
- }
- }
- }
|
Maintenant dans une console application j'aimerai charger ma dll et appeler ma méthode 'ReturnSomething'
donc je fais pour commencer:
Code :
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Reflection;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main( string[] args )
- {
- Assembly assembly = Assembly.LoadFrom( "ClassLibrary1.dll" );
- Object obj = assembly.CreateInstance( "Class1" );
- .../...
- }
- }
- }
|
Seulement le CreateInstance() me retourne null, je vois pas pourquoi... y'a t'il quelquechose de particulier à faire pour compiler ma class library ?
Merci pour votre aide.