Tuesday, 19 May 2009

Getting the Original Location of an Assembly’s Shadow Copy

If a test framework has loaded a shadow copy of your test assembly, and you need the path it was built to, you can use the following:

            var codebase = new Uri(Assembly.GetExecutingAssembly().CodeBase);

            var assembly = new FileInfo(codebase.LocalPath);

No comments:

Post a Comment