473,378 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How do I determine the exe filename at runtime?

nfr
I have a Singleton Model object that can be instantiated by different
applications at runtime. This object activates a Channel using the config
file in its constructor, which needs the name of the config file as a
string.

Because the object does not know the application in which it is being
instantiated and because it's constructor is private, I need to know how to
determine the name of the default config file (i.e., filename.exe.config).

Does anyone know how I might do this?
Nov 13 '05 #1
3 3013
nfr
> Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.
Nov 13 '05 #2
nfr
I take that back, it found the DLL it lives in but the the name of the .EXE
file that I am looking for.

"nfr" <nf*@nospam.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.

Nov 13 '05 #3
nfr
Here's the problem. I have a DLL that ultimately lives withn an EXE of some
sort. I would like for that object to be able to discover the name of the
EXE in which it lives.

"nfr" <nf*@nospam.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
I take that back, it found the DLL it lives in but the the name of the ..EXE file that I am looking for.

"nfr" <nf*@nospam.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the...
3
by: Phoe6 | last post by:
Hi all, I had a filesystem crash and when I retrieved the data back the files had random names without extension. I decided to write a script to determine the file extension and create a newfile...
10
by: drsmooth | last post by:
i need to open a file whose name i only know part of until runtime. it is based on a char value. the char represents gender and is either 'm' or ''f' i need to load from a text file called...
3
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.