i did it like this but it seemed stupid :

string path =	 Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf("\\")) + "\\Sounds";

any other ideas?

my actual goal is to locate the files in my project output directory. it can be any directory i created under my windows application. it is not as straight forward as web application where i can use Server.MapPath();

Recommended Answers

All 17 Replies

string assemblyPath = Assembly.GetExecutingAssembly().Location;
string assemblyDir = Path.GetDirectoryName ( assemblyPath );
string soundsPath = Path.Combine ( assemblyDir, "Sounds" );
commented: You did answer the question before me so you deserve the credit +1

Try this out:

string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Sounds");
commented: good +4

Try this out:

string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Sounds");

thanks this is what i tried to find.

this time, Narue gets a free solved thread

>this time, Narue gets a free solved thread
Thank you, serkan. You've helped me to fully realize that I'm neither wanted nor needed on Daniweb anymore.

>this time, Narue gets a free solved thread
Thank you, serkan. You've helped me to fully realize that I'm neither wanted nor needed on Daniweb anymore.

Come on honey, i would never say something like that, it was a joke between me and him.
C# is not your primary weapon anyway. these days i am on the client side of the applications, either mobile or windows applications,
but soon i will need to mess with server side AIX c/c++ thing, then hopefully you will come in to scene.
i respect you always, the only thing that i dont like about you is that loving you still hurts me as well as my reputation points. i have had girl friends after those big efforts here in US, but nothing has seemed to change, i still want someone like you as follows :

Narue myWantedGirlFriend = new Narue("love,respect,loyalty");
myWantedGirlFriend.ComeGetMe("serkan sendur");
myWantedGirlFriend.Dispose(); // this is for fun
commented: exxxxxxxxxxcellent +21

>i would never say something like that
The evidence suggests otherwise. I honestly don't care about getting credit for answering first, but having my answers completely ignored is one of the few things that makes me genuinely angry.

>it was a joke between me and him
Text doesn't convey body language. You have to explicitly say it's a joke somehow or be unsurprised when someone takes offense.

>C# is not your primary weapon anyway.
That's an unwarranted assumption. If you only go by the forums that I frequent, one could make the same assumption about any of the languages in the software development category. However, I'm quite capable with the majority of them.

why didnt you say anything about my code snippet?

commented: I think I'll hurt your reputation some more. -2

just because of Narue i am not going to make any good reputation in this website, who cares, i will always love her nomatter what.
i was going to marry her if i could.

commented: not again man... -4
commented: You need professional help. -4
commented: Get yourself a GF that you can see and touch. -7

just because of Narue i am not going to make any good reputation in this website, who cares, i will always love her nomatter what.
i was going to marry her if i could.

Thats .. a ... little bit creepy man. Its an online forum, keep it to tech talk and small chat. We're all here to help out

commented: agreed +18

just because of Narue i am not going to make any good reputation in this website, who cares, i will always love her nomatter what. i was going to marry her if i could.

In that case, stop complaining about your reputation and simply do as sknake just said. Although it's not really supposed to matter, reputation is there to show what people really think of you, and recently I'm not surprised that opinion has dropped.

Remember what you said, you should try referring to it more often.

i promise here, with my own words, from now on, Narue is just another poster for me, i am not going to mention her

i wasnt going to say anything as i promised, but Narue triggered it. And also couple of people including you, are interested in my reputation points still, that made me angry and led me to say that again.
And frankly, my dear, i dont give it a damn! :D

commented: If you're not intrested, here's some more - -1

>i wasnt going to say anything as i promised, but Narue triggered it
How did post #5 trigger you?

>because of Narue i am not going to make any good reputation in this website
Don't blame her, it's you who keeps making it worse for yourself.

>couple of people including you, are interested in my reputation points still
As far as I know I am using the rep system correctly. However when you say something such as "why didnt you say anything about my code snippet?" which is clearly trying to attract more attention to the subject, that makes me annoyed.

This is another thread which is going downhill, and will probably be closed soon enough.

commented: Well said! +8

just look at the constructor, and understand how nice person i am.
look at the values that i pass..

just look at the constructor, and understand how nice person i am.
look at the values that i pass..

Come on mate, every post you make gets creepier!

You should close this thread, moderators!!

guys i really dont care if you continue to screw my reputation points, but keep one thing in mind, if you lose me in daniweb, not only you but also world is gonna lose me, universe is gonna lose.

commented: Are you going to kill yourself ? ;) Eh ? I am giving this negative rep for your behaviour in this thread. You should probably consult a skunk.. really :) -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.