Partager via


Erreur du compilateur CS0596

Mise à jour : novembre 2007

Message d'erreur

L'attribut Guid doit être spécifié avec l'attribut ComImport
The Guid attribute must be specified with the ComImport attribute

L'attribut Guid doit être présent lors de l'utilisation de l'attribut ComImport.

L'exemple suivant génère l'erreur CS0596 :

// CS0596.cs
using System.Runtime.InteropServices;

namespace x
{
   [ComImport]   // CS0596
   // try the following line to resolve this CS0596
   // [ComImport, Guid("00000000-0000-0000-0000-000000000001")]
   public class a
   {
   }

   public class b
   {
      public static void Main()
      {
      }
   }
}