Get relative file path in a class library project that is being referenced by a web project

前端 未结 5 611
南方客
南方客 2020-12-08 16:48

I have an ASP.Net website that references a class library. In the class library I need to read a file into memory.

At the top level of my class library there is a fo

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 17:48

    I am not sure what you mean by a folder in the class library but you can use the current working directory if you wish to build a path as follows:

    System.IO.Directory.GetCurrentDirectory()
    

    You can then use the Path.Combine() method to build file paths.

提交回复
热议问题