views:

495

answers:

3

I want the location of the current execution project i.e in VB.NET/C# or the current class file's path?

Ok,let me elaborate i got 2 projects in one solution file,lets say A,B are projects, my startup project is B ,and im accessing a class file in A ,now i need to know virtual path of B. because i need it for accessing the resource file coz error pops up when using ExpressionBuilderContext

A: 

Try one of these:

        Console.WriteLine(Assembly.GetEntryAssembly().CodeBase);
        Console.WriteLine();
        Console.WriteLine(Assembly.GetEntryAssembly().Location);
        Console.WriteLine();
serialhobbyist
A: 

String strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

Alan B
Ok,let me elaborate i got 2 projects in one solution file,lets say A,B are projects, my startup project is B ,and im accessing a class file in A ,now i need to know virtual path of B. because i need to for accessing the resource file coz error pops up when using ExpressionBuilderContext
A: 

Under VB.net in Visual Studio 2008 I've been using the following :

Application.StartupPath
David_Jarrett