Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\TextFiles\ActiveUsers.txt'

后端 未结 4 2356
悲哀的现实
悲哀的现实 2021-02-19 10:07

I tried many ways to access a text file in my Visual Studio 2012 Solution from a folder named TextFiles

using (System.IO.StreamWriter file = new Sys         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 11:03

    ~ is not the "user home" or anything else in Windows. You can still set the path as relative to the working directory (where the executable is) by just not specifying a full path.

提交回复
热议问题