I am trying to pull the project name using the reflection, but during the substring method it give me \"index out of bound error\".
string s = System.Reflec
Have you debugged the code ? Are you sure that the 2nd line returns a value other than -1 ?
When no backslash is found in the string, LastIndexOf will return -1, which is not a valid index that can be used by Substring and thus, an 'index out of bounds' error will be thrown.
A safer method would be to extract the filename using the methods that are defined in the Path class. But, be aware that the 'project name' is not necessarly the same as the assembly name.