Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Monty - 06 Sep 2006 18:12 GMT
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
"Peter Huang" [MSFT] - 07 Sep 2006 05:09 GMT
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.
Monty - 07 Sep 2006 21:08 GMT
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

> Hi Monty,
>
[quoted text clipped - 35 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Peter Huang" [MSFT] - 08 Sep 2006 10:15 GMT
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.
Monty - 11 Sep 2006 06:01 GMT
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
"Peter Huang" [MSFT] - 12 Sep 2006 03:35 GMT
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.
Monty - 27 Sep 2006 14:07 GMT
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

> Hi Monty,
>
[quoted text clipped - 12 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.