|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
get the project pathhi,
I need to know the locaton of a project that i am referencing in my project. So in the project that i want to reference I created a public method in a class that returns Application.StartUpPath . However, when i access this method from my project it return the StartUpPath of MY project instead of the project that i have referenced. Can someone give me some idea how to get the path of the project that i am referncing. Regards, irfan Hi Irfan,
That is the expected behavior of Application.StartupPath, which returns the path for the .exe that started the application. Instead, try returning, System.Reflection.Assembly.GetExecutingAssembly().Location from the method in your referenced assembly. Realize, however, that this is not the path of the project reference, it's the path of the file that contains the assembly manifest. Once the code is compiled, there is no way to dynamically access the path to the actual VS "project" that created the assembly. If you need that information at runtime then you'll have to hard-code it, but I'm almost positive that's not what you mean :) -- Show quoteDave Sexton "Irfan" <ir***@asc-ltd.co.uk> wrote in message news:eRocxsvDHHA.3600@TK2MSFTNGP06.phx.gbl... > hi, > > I need to know the locaton of a project that i am referencing in my > project. > > So in the project that i want to reference > I created a public method in a class that returns Application.StartUpPath > . > > However, when i access this method from my project it return the > StartUpPath of MY project instead of the project that i have referenced. > > Can someone give me some idea how to get the path of the project that i am > referncing. > > Regards, > irfan > >
Other interesting topics
|
|||||||||||||||||||||||