I’ve a game project where I parse a .txt
document into a List
(method is called in c-tor):
private List<string> ParseVocabulary(string path)
{
using (var stream = new StreamReader(new FileStream(path, FileMode.Open)))
{
return stream
.ReadToEnd()
.Split(new char[] { 'n', 'r' }, StringSplitOptions.RemoveEmptyEntries)
.ToList();
}
}
Then I’ve created a Setup project for this game. And after intalling and running the shortcut on the desktop I have an error:
System.UnauthorizedAccessException: Access to the path 'C:Program Files (x86)WGWordsGameSetupResoursescitiesVocabulary.txt' is denied.
I’ve tryed to run the .exe
file in with admin rigths and I don’t have this error. How can I run a shortcut without error and using admin rigths?
kay4774 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.