all groups > dotnet interop > september 2006 >
You're in the

dotnet interop

group:

Cannot compile: Could not load file or assembly, The system cannot find the file specified


Cannot compile: Could not load file or assembly, The system cannot find the file specified Monty
9/6/2006 1:12:26 PM
dotnet interop:
I have a VS2005 VB.net project that references some COM libraries. I had a
reference to Interop Assembly I'd created using TlbImp on a COM TypeLib, but
I have since removed ~all~ references to this assembly in the code and in
the project references. When I attempt to build my project, I get this
error:
---------------------------------------------------------------------------
Cannot register assembly "C:\Projects\MyProject\bin\Debug\MyProject.dll".
Could not load file or assembly 'MyCOMInterfaces_DotNet, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=30090e356745ea33' or one of its
dependencies. The system cannot find the file specified.
---------------------------------------------------------------------------
where "MyCOMInterfaces_DotNet" is the name of the TlbImp-generated Interop
Assembly that I've removed all references to. I have looked EVERYWHERE to
find where this might be referenced from, but no luck. Is there a hidden
reference somewhere?

One (perhaps important) clue: This only happens when I have elected to Sign
the assembly and make it strong-named. If I do not sign it, the assembly
compiles fine.

I've been banging my head against this for days and, at this point, will try
anything. TIA!

Monty

RE: Cannot compile: Could not load file or assembly, The system cannot find the file specified v-phuang NO[at]SPAM online.microsoft.com (
9/7/2006 12:00:00 AM
Hi Monty,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you have a VB Project(e..g. A) ,
which will reference COM Library(e.g. B,C,D..).
Also you use tlbimp tool to generate a .NET interop library
MyCOMInterfaces_DotNet based on a COM library(e.g. X).
The Vb Project A will reference to the library MyCOMInterfaces_DotNet.

Now even if you have release all the references to the
MyCOMInterfaces_DotNet assembly, you still get the error message per your
post.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

From the description, the VB Project will also register for COM Interop.
So far I think you may try to check if any of the code may underlying using
the Interface from the MyCOMInterfaces_DotNet or COM library X.

Also to isolate the problem, I suggest you try to create a new project and
add all the common reference to the COM(B,C,D...) but not COM X.
And copy/paste/add the file/code line into the new project one by one to
see if the problem persists and which file or code line cause the behavior?

Please try to the steps and let me know the result.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: Cannot compile: Could not load file or assembly, The system cannot find the file specified Monty
9/7/2006 4:08:27 PM
Hi Peter,

Yes, you understood correctly. Quick summary:

VB.Net Assembly that is registered for COM Interop, and references a few COM
Libraries, for which I used TlbImp to create the interop assemblies ("B",
"C", "D"). One of the interop assemblies that I used to reference ("X"), I
no long reference and I have removed any interface from that assembly from
my code. I've searched my code repeatedly for any mention of it, but haven't
found any. NOTE: I only get this error if I sign the app and give it a
strong name.

I did recreate my project from a new one but copied each file into the new
project simultaneously... I think there are too many class/form
interdependencies to do it one form at a time (it won't compile). No luck
with that. Is there any tool I can use to find what causes this dependency?
I'd rather have the IDE refuse to compile and point out why than guess what
should be referenced and add it.

Thanks, Monty



[quoted text, click to view]

Re: Cannot compile: Could not load file or assembly, The system cannot find the file specified v-phuang NO[at]SPAM online.microsoft.com (
9/8/2006 9:15:35 AM
Hi Monty,

Thanks for your additional information which does help to troubleshoot the
issue.
Based on my research, I found a similar issue with different stongname key
with the strongnamed class library in the project.

So you may try to check all the strongnamed class library referenced in
your project are using the same snk file.
If yes, I suggest you use the same one for dependent projects

After that please do clean build(in the Build menu) and then rebuild the
solution.

If that still did not work, you may try the steps below.
1. Because the error is for register which occurred after the dll build
complete, so you may try to use Command line regasm.exe to do it manually
to see if it works.

2. Use the Filemon tool to monitor what file the IDE is trying to find when
building.
http://www.sysinternals.com/Utilities/Filemon.html

Please perform the steps and let me know the result.
I look forward to hearing from you.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: Cannot compile: Could not load file or assembly, The system cannot find the file specified Monty
9/11/2006 1:01:36 AM
Hi Peter,

When I read the part about the SNK file, I just created a new key for the
project and it now ~appears~ to be compiling as a signed assembly, so it
appears to have solved my problem. If not I will update you. Thank you for
your assistance!

Monty

Re: Cannot compile: Could not load file or assembly, The system cannot find the file specified v-phuang NO[at]SPAM online.microsoft.com (
9/12/2006 2:35:05 AM
Hi Monty,

How is the thing going on?
If you have any concern, please feel free to let me know.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: Cannot compile: Could not load file or assembly, The system cannot find the file specified Monty
9/27/2006 9:07:40 AM
Hi Peter,

Generating a new key appears to have done the trick. I don't know why, but
I'll take it. Thanks again.

Jeff


[quoted text, click to view]

AddThis Social Bookmark Button