1
Follows code:
public static string pathname = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.ToString()) + @"\Arquivo_Principal";
if (!File.Exists($@"{pathname}\Musica\{nomemusica}.txt"))
{
File.WriteAllText($@"{pathname}\Musica\{nomemusica}.txt", letramusica, Encoding.UTF8);
}
Some solution?
Are you running VS as an administrator? is Windows Forms? It looks like permission in the folder..
– Thiago Loureiro
Right, run as admin the application, check write permissions on Windows in that folder, in the security tab.. also check that these paths are correct {pathname}
– Thiago Loureiro
I imagine that in the other notebook there is the right folder? ... \
– Thiago Loureiro
Think the problem happens this when it doesn’t run exe like Adm
– Matheus Miranda
So there is no need to run as Adm, however you will have to grant permission in the folder, it goes in Explorer, property in the folder and security tab.. and grant permissions there.. especially if the application is ex on the Desktop.. then the security level is higher, and so on..
– Thiago Loureiro
Each time user install
.exe
, will get very boring to go there on permission > property > security. There is no way to take that permission ? Just install and run– Matheus Miranda
https://stackoverflow.com/questions/7288444/how-to-give-read-write-permissions-to-a-folder-during-installation-using-net
– Thiago Loureiro
Face, Micrososft’s Windows Installer gives a lot of headache. I decided to use Inno Setup. It already solves everything and for free.
– Matheus Miranda
I give up!!! Doubt anyone solve this problem.
– Matheus Miranda