Bonjour,

J'ai suivi le tutoriel de msdn pour créer une UFL pour crystal report.
C'est en fait une DLL qui sera disponible ensuite dans crystal.
Je développe sous Visual Studio 2008 sp1.

Mon message d'erreur à la compilation est :
MSB3212*: L'assembly "E:\...\CRUFL_MBRPTOutils.dll" n'a pas pu être converti en bibliothèque de types. L'exportateur de bibliothèques de types a rencontré une erreur lors du traitement de 'CRUFL_MBRPTOutils.IExchangeUfl, CRUFL_MBRPTOutils'. Erreur*: Élément introuvable.
Pouvez vous m'aider svp?

Merci

L'interface est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Imports System.Runtime.InteropServices
<ComVisible(True), InterfaceType(ComInterfaceType.InterfaceIsDual), GuidAttribute("b56126c6-bd32-4464-8484-01fd96511f9b")> _
Public Interface IExchangeUfl
    Function GetLibelleTraduit(ByVal idLibelle As Int32, ByVal idLangue As Int32) As String
End Interface
La Class est :
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Runtime.InteropServices
 
<ComVisible(True), ClassInterface(ClassInterfaceType.None), GuidAttribute("57efc420-0ffc-40d7-8f58-21723ffaa8d5")> _
Public Class CRUFL_MBRPTOutils : Implements IExchangeUfl
 
 
    Private strCatConn As String = Nothing
    Private ConnCat As SqlConnection = Nothing
    Private trCat As SqlTransaction
    Private strErrMsg As String = Nothing
    Private cmdCat As SqlCommand = Nothing
 
 
    Public Sub New()
        Me.strCatConn = "Data Source=MB-XP;Initial Catalog=CatWeb;Integrated Security=True"
 
        Connect()
    End Sub
 
 
    Public Function Connect() As Boolean
        If Me.strCatConn Is Nothing Then
            Throw New Exception("La chaine de connexion n'a pas été spécifié")
        End If
        If Me.ConnCat Is Nothing Then
            Try
                Me.ConnCat = New SqlConnection(Me.strCatConn)
                Me.ConnCat.InitializeLifetimeService()
 
            Catch ex As Exception
                System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                Me.strErrMsg = ex.Message
                Throw New Exception(ex.Message)
                Return False
            End Try
        End If
 
        Try
            If ConnCat.State <> ConnectionState.Closed Then
                ConnCat.Close()
            End If
            ConnCat.Open()
        Catch ex As Exception
            System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
            Me.strErrMsg = ex.Message
            Throw New Exception(ex.Message)
            Return False
        End Try
        Return True
    End Function
 
    Public Function Disconnect() As Boolean
        If Not Me.ConnCat Is Nothing Then
            Try
                Me.ConnCat.Close()
            Catch ex As Exception
                System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                Me.strErrMsg = ex.Message
                Return False
            End Try
            Return True
        Else
 
            Return True
        End If
    End Function
 
    Public Sub Dispose()
        Finalize()
    End Sub
 
    Public Function GetLibelleTraduit(ByVal idLibelle As Int32, ByVal idLangue As Int32) As String Implements IExchangeUfl.GetLibelleTraduit
        Dim strSQL As String
 
        Dim strC As String = ""
 
        strSQL = "SELECT dbo.TRIM(dbo.GetLibelleTraduit(" + idLangue.ToString + ", " + idLibelle.ToString + "))"
        Dim dr As DataTableReader = GetDataSet(strSQL).CreateDataReader
        If dr.HasRows Then
            dr.Read()
            strC = dr(0).ToString.Trim
        End If
        dr.Close()
 
        Return strC
 
    End Function
 
    Protected Overrides Sub Finalize()
        Try
            Disconnect()
            Me.ConnCat.Dispose()
            Me.ConnCat = Nothing
            Me.strErrMsg = Nothing
            MyBase.Finalize()
 
        Catch ex As Exception
            System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
        End Try
 
    End Sub
 
    Private Function GetDataSet(ByVal strSQL As String) As DataSet
        If Connect() Then
            Dim ds As New DataSet
            Try
                Dim rd As New SqlDataAdapter(strSQL, ConnCat)
                rd.Fill(ds)
                rd.Dispose()
            Catch ex As Exception
                System.Diagnostics.Debug.WriteLine(ex.ToString()) 'On écrit dans le stream de débug
                Me.strErrMsg = ex.Message
                Return Nothing
            End Try
 
            Disconnect()
            Return ds
        Else
            Return Nothing
        End If
 
    End Function
End Class