简体   繁体   中英

How to get the current startup project's physical location in VB.NET or C#?

I want the location of the current execution project ie 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

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

Application.StartupPath

字符串strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly()。CodeBase);

Try one of these:

        Console.WriteLine(Assembly.GetEntryAssembly().CodeBase);
        Console.WriteLine();
        Console.WriteLine(Assembly.GetEntryAssembly().Location);
        Console.WriteLine();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM