Bonjour

J'essaye dans un projet de test (tutoriel)
de crée un dll C# pour pouvoir l'utiliser dans un projet C++ suivant le tutoriel suivant :http://www.linux-bsd-central.com/ind...tent/view/278/

Je crée donc le projet en C# , crée la classe interface et la classe programme.
Mis le option du projet a "Register for COM interop"
Signer l'assembly , et mis Assembly COm Visible dans les Assembly information.

J'ai récupéré le guid présent dans cette fenetre (assembly information)
et ajouté le tout à mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace DLLCSharp
{   
    [Guid("e5623cc0-4394-4bb8-8c30-7cc9a732d3f6")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    public interface IClient
    {
        [DispId(1)]
        int SendMessage(string MessageToSend);
        [DispId(2)]
        string GetMessage(int id);
    }
 
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("DLLCSharp.Client")]
    [ComSourceInterfaces(typeof(IClient))]
    public class Client:IClient
    {
        string[] Message = new string[256];
        int Cpt = 0;
        public int SendMessage(string MessageToSend)
        {
            string tmp = MessageToSend.ToUpper();
            Message[Cpt++] = tmp;
            return Cpt;
        }
        public string GetMessage(int id)
        {
            return string.Format("{0}:{1}", id, Message[id]);
        }
 
    }
}
en compilant la DLL j'ai l'erreur suivante que je ne comprend pas :

1>c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3019,9): error MSB3212: The assembly "C:\Users\Christophe\Documents\CHRISTOPHE\SOFT_DEVELOPPEMENT\MixedDLLC++CSharp\DLLCSharp\bin\Debug\DLLCSharp.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'DLLCSharp.IClient, DLLCSharp'. Error: Élément introuvable.
Si quelqu'un peut m'aiguiller, je ne vois pas ou chercher et à quel niveau se situe mon erreur.

Cordialement