How do you get the solution directory in C# (VS 2008) in code?

后端 未结 6 2366
时光取名叫无心
时光取名叫无心 2020-12-10 05:29

Got an annoying problem here. I\'ve got an NHibernate/Forms application I\'m working through SVN. I made some of my own controls, but when I drag and drop those (or view som

6条回答
  •  孤街浪徒
    2020-12-10 05:55

    It sounds like you just need to code a better path to your configuration file.

    If you do something like this:

    configPath =  Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "\\PathToCFG");
    

    you should not be messed up when Windows changes the current directory on you.

    Edit: You may be running into an issue with the Visual Studio hosting process. Can you disable this? There is a check box under project properties \ debug.

提交回复
热议问题