Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

c# - can give administration privileges to Application folder when creating windows installer

I'm working with WPF project.I want to know can i give admin privileges to application folder when creating windows installer

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may need to clarify your question. There is some overlap here with Stein's answer, but to expand...

Folders do not get administrative privileges. Programs can get elevated privileges. Folders can have access rights that make them more (or less) accessible to programs with various privileges. Therefore:

  1. If you want the installer to somehow enable your program to run as administrator (elevated), then the installer cannot do this. The program itself needs an elevation manifest which requests elevation to administrator privilege, which means that ordinary limited users cannot run it.

  2. If the issue is that you have (or want to create) data files in the Program Files folder and your application cannot write to them when limited users run it, then the program is storing these files in the wrong location. Folders have names such as User's Application Data because that's what they are supposed to be used for. Changing the security of the Program Files folder containing your program code is generally considered insecure because limited users can then change your code files. The certification rules are a useful guideline:

"10.3 Your app data, which must be shared among users on the computer, should be stored within ProgramData

10.4 Your app’s data that is exclusive to a specific user and that is not to be shared with other users of the computer, must be stored in Users\AppData"

You haven't said what tool you are using to create your MSI file, that might be useful to know if you have further questions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...