CodePudding user response:
Online for bosses, urgentCodePudding user response:
Check permissions not enough ah?If involves the configuration file to read, want to consider the problem of unable to properly read
If involves creating folders, want to consider the question of creating failure
CodePudding user response:
Should be the file is not completely control you check folder permissionsCodePudding user response:
I now find, as long as according to him to the path of the installation, the only change in which drive, is no problem, as long as changed his path, no matter in which drive, has a problem, how is that broken?CodePudding user response:
Should be permission problems, such as other documents involved in the process of the program runs, speaking, reading and writing, or a program generated files, the need to manipulate files or folders without permission,CodePudding user response:
How am I supposed to give it permission in the code, after all others to install, I won't be able to change their computers folder permissions?CodePudding user response:
Write a log file to capture the abnormal information, code to create the folder usually have permissionsCodePudding user response:
You need before packaging, can custom code, give the installation path is completely written permission, do not have permission to write to the log file will make a mistake, unless you don't write the log, how to obtain the installation path, first look for information, I now WPF installation package, is to have a complete solution, many clients machines, very strange, some directories are no write permissions, unless, that is, the human, the installation package, the looks be like simple, is also the course of the coming months, I met one solve two, is a slowly, step to step 1,///& lt; Summary>
///to add the users folder, everyone user groups full control permissions
///& lt;/summary>
///& lt; Param name="dirPath & gt;"
The static void AddSecurityControll2Folder (string dirPath)
{
//get the folder information
DirectoryInfo dir=new DirectoryInfo (dirPath);
//get all the access to the folder
System. Security. The AccessControl. DirectorySecurity dirSecurity=dir. GetAccessControl (AccessControlSections. All);
//set file ACL inheritance
InheritanceFlags inherits=InheritanceFlags. ContainerInherit | InheritanceFlags. ObjectInherit;
//add ereryone user group access rules full control permissions
FileSystemAccessRule everyoneFileSystemAccessRule=new FileSystemAccessRule (" Everyone ", FileSystemRights FullControl, inherits, PropagationFlags. None, AccessControlType. Allow);
//add the Users access user group rules full control permissions
FileSystemAccessRule usersFileSystemAccessRule=new FileSystemAccessRule (" Users ", FileSystemRights FullControl, inherits, PropagationFlags. None, AccessControlType. Allow);
Bool isModified=false;
DirSecurity. ModifyAccessRule (AccessControlModification. Add, everyoneFileSystemAccessRule, out isModified);
DirSecurity. ModifyAccessRule (AccessControlModification. Add, usersFileSystemAccessRule, out isModified);
//set access permissions
Dir. SetAccessControl (dirSecurity);
}
CodePudding user response:
Isn't this reference you didn't pack come in? Should put all use a reference to the packaging, the references are in the program to convert into the bagCodePudding user response:
Check whether it contains the path when packaged, or sometimes involves disk C need some folder permissionsCodePudding user response:
Should be a permissions problem,CodePudding user response:
Try to run as an administrator.CodePudding user response:
Not enough permissions,Everyone access to the folder first, test,