all groups > dotnet interop > november 2005 >
You're in the

dotnet interop

group:

file or assembly name XXXX not found error for .NET COM interop in VBA


file or assembly name XXXX not found error for .NET COM interop in VBA askingroups NO[at]SPAM gmail.com
11/30/2005 8:00:37 PM
dotnet interop:
Hi,

I am kind of stuck with this problem when trying to use the COM interop
functionality of .NET.

I am working on .NET 2.0 FCS on Windows 2000 Advanced Server.

Here is the issue:

I had a small assembly built in .NET 2.0 beta 2 with a simple class
definition like this:


using System;
using System.Runtime.InteropServices;
namespace MyLibrary{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class Class1: IClass1{
public int myFirstDll()
{
return 6;
}
}
[ComVisible(true)]
public interface IClass1{
int myFirstDll();
}
}

I had the output as assembly and made sure the VS.NET 2005 beta 2
generates .tlb for COM interop by setting the property as part of the
build.

In Microsoft Excel I opened VBA and added this tlb as reference and the
code below in VBA worked fine:
DIM class11 as Class1
set class11 = new Class1

I started having issues as soon as I upgraded to .NET 2.0 final
release.
When I rebuilt the project with VS.NET 2005 and re-added the tlb into
Excel VBA, I started getting errors when I try to instantiate the class
in VBA.
The error said:
"File or assembly name MyLibrary, or one of its dependencies, was not
found."

I am not sure how to debug this problem because the assembly works fine
within the .NET environment itself.

What are the tools available to see the exact error instead of this
generic message?
Anybody else faced similar problems and found solutions?

Any ideas or links to websites for hints would also help.

Any help in this regard is greatly appreciated.
thanks in advance.
Re: file or assembly name XXXX not found error for .NET COM interop in VBA askingroups NO[at]SPAM gmail.com
12/1/2005 3:38:59 PM
This looked like a bug on Microsoft's part. I found a work around by
first creating a Excel.exe.config file with these entries:

<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v2.0.50110" />
<supportedRuntime version="v1.1.4322" />
<supportedRuntime version="v1.0.3705" />
<requiredRuntime version="v1.0.3705" />
</startup>
</configuration>

Then, when I searched further on the net, found this update fix from
Microsoft which fixed the problem even without the config file above:
http://www.microsoft.com/downloads/details.aspx?FamilyId=1B0BFB35-C252-43CC-8A2A-6A64D6AC4670&displaylang=en

hope this helps.
thanks
AddThis Social Bookmark Button