Hi Bill,
Thanks for your feedback.
Yes, System.Reflection.Assembly.GetExecutingAssembly(). CodeBase should meet
your need, it will return the original assembly location.
However, I think the solution I provided in the last reply should also get
what you want. Once we have used AppDomainSetup.ShadowCopyDirectories to
get where the assembly is shadown copied from, we can just add the assembly
dll name to this directory to get its original location, this should be the
same as what System.Reflection.Assembly.GetExecutingAssembly(). CodeBase
returns.
Because Asp.net used shadow copy technology, we can do the test in an
Asp.net application. I print out the different path with the code snippet
below:
private void Page_Load(object sender, System.EventArgs e)
{
this.Response.Write(AppDomain.CurrentDomain.BaseDi rectory+"<br>");
this.Response.Write(AppDomain.CurrentDomain.Shadow CopyFiles.ToString()+"<br>
");
this.Response.Write(AppDomain.CurrentDomain.SetupI nformation.CachePath.ToStr
ing()+"<br>");
this.Response.Write(AppDomain.CurrentDomain.SetupI nformation.ShadowCopyDirec
tories.ToString()+"<br>");
this.Response.Write(System.Reflection.Assembly.Get ExecutingAssembly().CodeBa
se+"<br>");
// Put user code to initialize the page here
}
On my machine, the output is:
c:/inetpub/wwwroot/webapp/shadowcopytest/
True
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Tempo rary ASP.NET
Files\webapp_shadowcopytest\7a027e7d
c:\inetpub\wwwroot\webapp\shadowcopytest\bin
file:///c:/inetpub/wwwroot/webapp/shadowcopytest/bin/shadowcopytest.DLL
As we can see, we can add
AppDomain.CurrentDomain.SetupInformation.ShadowCop yDirectories with the dll
file name to get the original assembly location full path.
Hope this clarify my point.
================================================== =====
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.