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 / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Can't get Assembly.GetCallingAssembly() to reflect the proper assembly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Wood - 30 Nov 2006 15:44 GMT
I have an executable that references a separate .dll assembly.  Inside the
.dll I call GetCallingAssembly and I always get a reference to the .exe.

Documentation for GetCallingAssembly says, "Returns the Assembly of the
method that invoked the currently executing method."  Obviously that wasn't
the case.  Reading further, I see that the copiler may be inlinining my
method and that I should decorate the method I'm calling GetCallingAssembly
from with MethodImpl(MethodImplOptions.NoInlining).  No joy.

Is there anything else I can try?  I couldn't find anyone else who
experienced this...
Steve B. - 30 Nov 2006 16:56 GMT
Use GetExecutingAssembly if you wantto return the dll... the exe is the
calling assembly, not the executing...

>I have an executable that references a separate .dll assembly.  Inside the
>.dll I call GetCallingAssembly and I always get a reference to the .exe.
[quoted text clipped - 8 lines]
> Is there anything else I can try?  I couldn't find anyone else who
> experienced this...
Brad Wood - 30 Nov 2006 23:12 GMT
> Use GetExecutingAssembly if you wantto return the dll... the exe is the
> calling assembly, not the executing...

I tried that.  Same thing with or w/o the attribute.
Brad Wood - 30 Nov 2006 23:38 GMT
> Use GetExecutingAssembly if you wantto return the dll... the exe is the
> calling assembly, not the executing...

Sorry, this was a Copy Local issue.  I had tried GetExecutingAssebly, but I
was extracting the path (which always returned the path to the location of
the exe).  I was expecting the location of the .dll as I referenced it.

And yes, I should use GetExectingAssembly.

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.