![]() ![]() For example, if the assembly was downloaded from the internet, its CodeBase may start with " but its Location may start with "C:\". "The CodeBase is a URL to the place where the file was found, while the Location is the path where it was actually loaded. It's been working, but I'm no longer sure it is 100% correct. String s = a.CodeBase.ToUpper() // file:///c:/path/name.dllĪssert.AreEqual(true, s.StartsWith("FILE://"), "CodeBase is " + s) I've been using Assembly.CodeBase instead of Location: Assembly a Ī = Assembly.GetAssembly(typeof(DaoTests)) The three suggestions so far fail me when I run from the MbUnit Gui: I want the path to always resolve correctly regardless of whether the testing dll is run from TestDriven.NET, the MbUnit GUI or something else.Įdit: People seem to be misunderstanding what I'm asking.Ĭ:\projects\myapplication\daotests\bin\Debug\daotests.dllĬ:\projects\myapplication\daotests\bin\Debug\ ![]() Is there a way to get the path for the assembly in which the current code resides? I do not want the path of the calling assembly, just the one containing the code.īasically my unit test needs to read some xml test files which are located relative to the dll. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |