Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a Windows Form based application and writing some logs detail in a file as "logs.txt". This file is available in another folder named as "Logs". No issue found on local, but when i create Setup of it and install in on my machine i found that write permission is not available on "Logs" directory. When i give full permission then again it working fine.

Is there any way to provide full permission when creating an Setup project of my Windows Form application?

The above issue were found on Windows 7.
Posted
Updated 9-Aug-15 20:12pm
v2

The best solution is "don't".
Move your logs file to somewhere that already has permission: Where should I store my data?[^] should help.

Storing data in a fixed (or relative to the application EXE) folder is supposed to be difficult to prevent virus activity, and it's likely to get more difficult as time goes on. It's also less likely that anything under "Program Files" will be regularly backed up.
 
Share this answer
 
Comments
Ajay_Saini 10-Aug-15 3:24am    
So the above code should be included in my Windows Form Project only.. correct?
OriginalGriff 10-Aug-15 3:43am    
Yes - it replaces the code you use to get the path to your log file, is all. Because you don't need specific permissions to access those folders (and should never need permissions) there is nothing needed in your setup to allow for it.
Ajay_Saini 10-Aug-15 3:50am    
Thanks... So is it also possible to access that log file in my another project (say TrackErrorCodes) inside same solution? As i am tracking the error code written by my Windows Form Project?
OriginalGriff 10-Aug-15 3:59am    
Yes - because it returns a folder that is dependant on the user, not the application.
You can even set your app up to use separate log files for each user registered on the system, or one file for all users, depending on which special enumeration you select as the path base.
Hello,

u just add one application manifest file in your project . and change the credential to the administrator . like this
<security>
      <requestedprivileges xmlns="urn:schemas-microsoft-com:asm.v3">
 <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the
            requestedExecutionLevel node with one of the following.
 
        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
 
            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward
            compatibility then delete the requestedExecutionLevel node.
        -->

   <requestedexecutionlevel level="requireAdministrator" uiaccess="false" />
 
      </requestedprivileges>
    </security>


thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900