-1

I have been trying to get any one of the following directories:

  • Root of solution folder
  • Startup project folder

I came across this:

System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location );

but i'm unsure what it's actually showing me.

for example, the folder i'm trying to get to is:

C:\Users\James\Documents\Visual Studio 2013\Projects\Test\Test.WebUI\Uploads

And the above function returns this:

C:\Users\James\AppData\Local\assembly\dl3\1RC2V770.35T\WML2RQJT.GX5\9ebc1d95\b8f9a830_5676d001

Is this at all helpful to me?

The context of the issue is that i'm running an entity framework seeder and need access to the startup projects folder structure.

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233

1 Answers1

1

What you are seeing is the shadow copy folder that .NET uses for cache. It is specified in Windows Registry under HKCU\Software\Microsoft\Fusion\DownloadCacheLocation. Shadow copying is a feature in the .NET framework to allow assemblies used in an app domain to be updated without unloading the app domain.

There is a similar question here.

That is the reason why you can't retrieve your original folder location using System.Reflection.Assembly.GetExecutingAssembly().Location

You might want to look at AppDomainSetup.ShadowCopyDirectories if you want to change/read the directories where the dlls are stored.

Hope it helps

Community
  • 1
  • 1
codingadventures
  • 2,924
  • 2
  • 19
  • 36