DOC: "File or assembly name EventSrc, or one of its dependencies, was not found" Error When You Export the Assembly to a Type Library by Using TlbExp.exe (815636)
The information in this article applies to:
- Microsoft .NET Framework 1.0
- Microsoft .NET Framework 1.1
SYMPTOMSWhen you follow the steps in the "Raising Events
Handled by a COM Sink" MSDN article, you receive the following error when you
export the assembly to a Type Library by using Tlbexp.exe: TlbExp error: File or assembly name EventSrc, or one of its
dependencies, was not found. For additional information, click the
following link to view the "Raising Events Handled by a COM Sink" MSDN article: CAUSEYou can specify the CustomInterfaceAttribute with a string parameter. The string argument must specify the
event source interface. The string argument can also specify the strong name of
the assembly. The strong name must be separated by a comma. In the "Raising
Events Handled by a COM Sink" MSDN article, the EventSrc in the ComSourceInterfaces attribute string argument specifies the assembly that the event
source is defined in. The default assembly name property for the example is set
as ClassLibrary1 (the default name of your project). When the Type Library
Exporter (TlbExp) Microsoft .NET Framework tool exports the event source interface
from an assembly, it interprets the attributes associated with the class. TlbExp expects the event source interface that is defined by the ComSourceInterfaces attribute to be in an assembly named EventSrc. RESOLUTIONTo resolve the problem in the code, use one of the following
four methods:
- Remove the reference for the assembly from the ComSourceInterfaces attribute. To do this, follow the steps for one of the following
samples:
- Microsoft Visual Basic Sample
- Make the following change to your code
sample:
Replace<ComSourceInterfaces("EventSource.ButtonEvents, EventSrc")> _ with<ComSourceInterfaces("EventSource.ButtonEvents")> _ Note You must make this change at line 25 of the Visual Basic sample
for the Managed server (event source) code. - Clear the Root namespace property for the project. To do this, follow these steps:
- In Solution Explorer, expand the
Project node, and then click
Properties.
- In the Project Property Pages
dialog box, click to select General under Common
Properties.
- Clear the contents of the Root
namespace property. Click OK.
- Microsoft Visual C# Sample Make the following changes to your code sample:
Replace[ComSourceInterfaces("EventSource.ButtonEvents, EventSrc")] with[ComSourceInterfaces("EventSource.ButtonEvents")] Note You must make this change at line 21 of the Visual C# sample for
the Managed server (event source) code.
- Instead of using the string argument for the ComSourceInterface attribute, use the type argument. To do this, use one of the
following samples.
- Visual Basic Sample
- Make the following change to your code
sample:
Replace<ComSourceInterfaces("EventSource.ButtonEvents, EventSrc")> _ with<ComSourceInterfaces(GetType(EventSource.ButtonEvents))> _ Note You must make this change at line 25 of the Visual Basic sample
for the Managed server (event source) code. - Visual C# Sample Make the following changes to your code sample:
Replace[ComSourceInterfaces("EventSource.ButtonEvents, EventSrc")] with[ComSourceInterfaces(typeof(EventSource.ButtonEvents))] Note You must make this change at line 21 of the Visual C# sample for
the Managed server (event source) code.
- Change the assembly name to EventSrc in Visual Studio .NET. To do this, follow these steps to change
the default value of the Assembly Name property:
- In Visual Studio .NET, expand the Project node in Solution Explorer, and then click
Properties.
- In the Project Property Pages dialog
box, click General under Common
Properties.
- Change the default value of the Assembly
Name to EventSrc in the right pane of the
Project Property Pages dialog box. Click
OK.
- For the Visual Basic sample, clear the contents of the
Root namespace property. To do this, follow these steps:
- In Solution Explorer, expand the
Project node, and then click
Properties.
- In the Project Property Pages
dialog box, click to select General under Common
Properties.
- Clear the contents of the Root
namespace property. Click OK.
- When you create the Visual Basic project or the Visual C#
project in Visual Studio .NET to test the sample code, set the name of the
project to EventSrc.
For the Visual Basic
sample, clear the contents of the Root namespace property. To
do this, follow these steps:
- In Visual Studio .NET, expand the
Project node in Solution Explorer, and then click
Properties.
- In the Project Property Pages dialog
box, click to select General under Common
Properties.
- Clear the contents of the Root
namespace property. Click OK.
Modification Type: | Major | Last Reviewed: | 1/19/2004 |
---|
Keywords: | kbdocerr KB815636 kbAudDeveloper |
---|
|