Question

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

Was it helpful?

Solution

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

OTHER TIPS

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

Application.StartupPath

Try one of these:

        Console.WriteLine(Assembly.GetEntryAssembly().CodeBase);
        Console.WriteLine();
        Console.WriteLine(Assembly.GetEntryAssembly().Location);
        Console.WriteLine();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top