| Author |
Message |
Matt::
Joined: 20 Sep 2010 Posts: 4
|
Posted: Mon Sep 20, 2010 11:33 am Post subject: Assembly.GetExecutingAssembly().Location is empty |
|
|
I am embedding (not merging) an assembly into an .aspx project.
The following code:
| Code: |
Assembly currentAssembly = Assembly.GetExecutingAssembly();
var folder = Path.GetDirectoryName(currentAssembly.Location); |
blows because Location is "".
What do I do to get the assembly location?
thanks
Matt |
|
| Back to top |
|
 |
Alex.Davies
Joined: 02 Dec 2008 Posts: 335 Location: Cambridge, uk
|
Posted: Thu Sep 23, 2010 11:20 am Post subject: |
|
|
Embedded assemblies have no useful location to tell you. They aren't decompressed to a temporary location or anything, they are simply loaded from memory. _________________ Alex
Developer,
Red Gate .NET Tools |
|
| Back to top |
|
 |
Matt::
Joined: 20 Sep 2010 Posts: 4
|
Posted: Thu Sep 23, 2010 12:06 pm Post subject: |
|
|
yes, but it's 'host' assembly must have a location.
Is there any way to get at that? |
|
| Back to top |
|
 |
simon.jackson
Joined: 08 Jan 2009 Posts: 45
|
Posted: Tue Nov 30, 2010 12:26 pm Post subject: |
|
|
Assembly.CodeBase is still set.
string codeBase = assembly.CodeBase;
string localPath = new Uri(codeBase).LocalPath;//NOTE: assembly.Location will often be "" because of {SA}
I'm not sure if this behaviour is guaranteed in {SA} |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group