Hi Claudio,
We had the same problem here. The same happened as we wanted to use
the assembly with LabView, where the application path is the path
where the LabView application is, not the assembly. We use this code
to resolve a relative path to a absolute path in relation of the
assemblys original path (where 'aFilePath' is the path to the INI-
File):
string xAssemblyPath =
System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
xAssemblyPath = Path.GetDirectoryName(xAssemblyPath);
Uri xUri = new Uri(xAssemblyPath);
xAssemblyPath = xUri.LocalPath;
if (!Path.IsPathRooted(aFilePath))
{
_RootedFilePath = Path.Combine(xAssemblyPath, aFilePath);
}
else
{
_RootedFilePath = aFilePath;
}
Cheers Lothar
On 21 Mai, 15:00, "makka <Claudio Maccari/>"
<[EMAIL PROTECTED]> wrote:
> I need to read information from an .INI file using this API
> [DllImport("kernel32")]
> private static extern int GetPrivateProfileString(string
> section,string key,string def, StringBuilder retVal,int size,string
> filePath);
>
> the .INI file is located in thebin folder.
> To get the right bin folder path I use
> Environment.CurrentDirectory
> or
> Assembly.GetExecutingAssembly().Location
>
> IF I run the tests insideVS2005 (with TestDriven.NET) they works fine
> but if I use mbUnit GUI I get a wrong folder.
>
> Can someone help me?
> Many thk.
> Claudio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---