I have a game project where I parse a .txt
document into a List
(method is called in ctor):
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 installing and running the shortcut on the desktop I get an error:
System.UnauthorizedAccessException: Access to the path ‘C:Program Files (x86)WGWordsGameSetupResoursescitiesVocabulary.txt’ is denied.
I’ve tried to run the .exe
file in with admin rights and I don’t get this error.
How can I run a shortcut without error and using admin rights?
prometey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.